Introduction

Life expectancy has increased dramatically over the last few centuries. Since 1900 the global average life expectancy has more than doubled and there has been a huge development in health sector in the past 15 years resulting in improvement of human mortality rates especially in the developing nations in comparison to the past 30 years. Therefore, in this project, only data from year 2000-2015 is considered for exploration and analysis.

This dataset is a compilation of data from the Global Health Observatory (GHO) and United Nations. The GHO data repository is WHO’s gateway to health-related statistics which provides access to a variety of indicators on priority health topics including mortality and burden of diseases, environmental health, violence and injuries etc. (http://apps.who.int/gho/data/node.resources). The economic data such as GDP is collected from the National Accounts Main Aggregates Database under United Nations which collects and disseminates economic statistics from countries worldwide (https://unstats.un.org/unsd/snaama/Index).

This dataset is cleaned by removing some missing values, maily for population, Hepatitis B and GDP from less known countries and shared on Kaggle website (https://www.kaggle.com/kumarajarshi/life-expectancy-who). The final dataset contains 2938 observations with 22 variables which are more critical and representative among all the categories of health-related factors from year 2000 - 2015 for 193 countries.

The description of each variable for this dataset is listed below:

For this project, we would like to:


Methods

Missing values analysis:

original_data = read.csv("Life Expectancy Data.csv")
kable(t(original_data[sample(nrow(original_data), 5), ]))
2609 2369 1177 1098 1252
Country Timor-Leste Solomon Islands Iceland Guinea-Bissau Ireland
Year 2008 2008 2009 2008 2014
Status Developing Developing Developed Developing Developed
Life.expectancy 66.2 68.0 81.6 55.6 81.2
Adult.Mortality 168 193 55 297 66
infant.deaths 2 0 0 5 0
Alcohol 0.06 1.09 10.22 2.64 10.75
percentage.expenditure 36.69 19.75 687.58 28.30 746.37
Hepatitis.B 79 89 NA NA 95
Measles 0 0 0 12 33
BMI 14.7 44.7 58.5 21.9 62.1
under.five.deaths 3 0 0 7 0
Polio 79 94 96 77 96
Total.expenditure 0.74 5.97 9.12 6.50 7.78
Diphtheria 79 89 96 77 96
HIV.AIDS 0.1 0.1 0.1 6.0 0.1
GDP 643.7 125.8 4461.9 583.5 5553.3
Population 17811 54477 318499 148841 4617225
thinness..1.19.years 11.7 1.2 0.9 8.5 0.3
thinness.5.9.years 11.7 1.2 0.9 8.4 0.2
Income.composition.of.resources 0.566 0.489 0.894 0.398 0.910
Schooling 11.7 9.2 18.4 8.8 18.6
kable(colSums(is.na(original_data)), col.names = "Number of missing values")
Number of missing values
Country 0
Year 0
Status 0
Life.expectancy 10
Adult.Mortality 10
infant.deaths 0
Alcohol 194
percentage.expenditure 0
Hepatitis.B 553
Measles 0
BMI 34
under.five.deaths 0
Polio 19
Total.expenditure 226
Diphtheria 19
HIV.AIDS 0
GDP 448
Population 652
thinness..1.19.years 34
thinness.5.9.years 34
Income.composition.of.resources 167
Schooling 163

1289 samples have at least one missing value. Alcohol is missing in 194 samples all of them belongs to 2015 year and these countiries definately should have alcohol consuption more than 0. The data was collected in 2015 when data about alcohol consumption simply was not available.

Life expextancy and adult mortality is missing for 10 samples in 2013, all of them belongs to islands.

Hepatitis B is missing in 553 samples. Samples belongs to different countries and years.

nrow(original_data)
## [1] 2938
data = na.omit(original_data)
nrow(original_data) - nrow(data)
## [1] 1289
summary(data)
##         Country          Year             Status     Life.expectancy
##  Afghanistan:  16   Min.   :2000   Developed : 242   Min.   :44.0   
##  Albania    :  16   1st Qu.:2005   Developing:1407   1st Qu.:64.4   
##  Armenia    :  15   Median :2008                     Median :71.7   
##  Austria    :  15   Mean   :2008                     Mean   :69.3   
##  Belarus    :  15   3rd Qu.:2011                     3rd Qu.:75.0   
##  Belgium    :  15   Max.   :2015                     Max.   :89.0   
##  (Other)    :1557                                                   
##  Adult.Mortality infant.deaths       Alcohol      percentage.expenditure
##  Min.   :  1     Min.   :   0.0   Min.   : 0.01   Min.   :    0         
##  1st Qu.: 77     1st Qu.:   1.0   1st Qu.: 0.81   1st Qu.:   37         
##  Median :148     Median :   3.0   Median : 3.79   Median :  145         
##  Mean   :168     Mean   :  32.6   Mean   : 4.53   Mean   :  699         
##  3rd Qu.:227     3rd Qu.:  22.0   3rd Qu.: 7.34   3rd Qu.:  509         
##  Max.   :723     Max.   :1600.0   Max.   :17.87   Max.   :18961         
##                                                                         
##   Hepatitis.B      Measles            BMI       under.five.deaths
##  Min.   : 2.0   Min.   :     0   Min.   : 2.0   Min.   :   0.0   
##  1st Qu.:74.0   1st Qu.:     0   1st Qu.:19.5   1st Qu.:   1.0   
##  Median :89.0   Median :    15   Median :43.7   Median :   4.0   
##  Mean   :79.2   Mean   :  2224   Mean   :38.1   Mean   :  44.2   
##  3rd Qu.:96.0   3rd Qu.:   373   3rd Qu.:55.8   3rd Qu.:  29.0   
##  Max.   :99.0   Max.   :131441   Max.   :77.1   Max.   :2100.0   
##                                                                  
##      Polio      Total.expenditure   Diphtheria      HIV.AIDS    
##  Min.   : 3.0   Min.   : 0.74     Min.   : 2.0   Min.   : 0.10  
##  1st Qu.:81.0   1st Qu.: 4.41     1st Qu.:82.0   1st Qu.: 0.10  
##  Median :93.0   Median : 5.84     Median :92.0   Median : 0.10  
##  Mean   :83.6   Mean   : 5.96     Mean   :84.2   Mean   : 1.98  
##  3rd Qu.:97.0   3rd Qu.: 7.47     3rd Qu.:97.0   3rd Qu.: 0.70  
##  Max.   :99.0   Max.   :14.39     Max.   :99.0   Max.   :50.60  
##                                                                 
##       GDP           Population       thinness..1.19.years thinness.5.9.years
##  Min.   :     2   Min.   :3.40e+01   Min.   : 0.10        Min.   : 0.10     
##  1st Qu.:   462   1st Qu.:1.92e+05   1st Qu.: 1.60        1st Qu.: 1.70     
##  Median :  1593   Median :1.42e+06   Median : 3.00        Median : 3.20     
##  Mean   :  5566   Mean   :1.47e+07   Mean   : 4.85        Mean   : 4.91     
##  3rd Qu.:  4719   3rd Qu.:7.66e+06   3rd Qu.: 7.10        3rd Qu.: 7.10     
##  Max.   :119173   Max.   :1.29e+09   Max.   :27.20        Max.   :28.20     
##                                                                             
##  Income.composition.of.resources   Schooling   
##  Min.   :0.000                   Min.   : 4.2  
##  1st Qu.:0.509                   1st Qu.:10.3  
##  Median :0.673                   Median :12.3  
##  Mean   :0.632                   Mean   :12.1  
##  3rd Qu.:0.751                   3rd Qu.:14.0  
##  Max.   :0.936                   Max.   :20.7  
## 

Looking at the summary data we can already see some inconsistencies. In Infant Deaths we see that the max value listed is 1600 which doesn’t make sense since we’re working with per 1000 population data. The same or similar numbers we can see for Infant deaths, Measles, Under five deaths

boxplot(data$Adult.Mortality)
kable(t(head(data[data$Adult.Mortality > boxplot(data$Adult.Mortality)$stats[5], ])))

346 347 348 349 350 351
Country Botswana Botswana Botswana Botswana Botswana Botswana
Year 2006 2005 2004 2003 2002 2001
Status Developing Developing Developing Developing Developing Developing
Life.expectancy 54.8 51.7 48.1 46.4 46.0 46.7
Adult.Mortality 491 566 652 693 699 679
infant.deaths 2 2 2 2 2 2
Alcohol 6.45 6.37 4.90 5.51 6.41 5.48
percentage.expenditure 76.32 629.84 469.58 299.37 6.33 306.95
Hepatitis.B 93 92 91 9 88 87
Measles 6 5 1 59 7 1
BMI 33.2 32.7 32.2 31.6 31.1 3.5
under.five.deaths 3 3 4 4 4 4
Polio 96 96 96 96 97 97
Total.expenditure 4.93 5.62 5.56 4.65 6.47 5.73
Diphtheria 96 96 96 96 97 97
HIV.AIDS 14.4 20.6 28.4 31.9 34.6 37.2
GDP 5374.6 5351.3 4896.6 4163.7 355.6 3129.0
Population 1884238 1855852 182933 184339 1779953 1754935
thinness..1.19.years 9.6 1.0 1.5 1.9 11.4 11.8
thinness.5.9.years 9.4 9.9 1.4 1.8 11.3 11.8
Income.composition.of.resources 0.610 0.593 0.580 0.567 0.558 0.560
Schooling 11.9 11.9 11.8 11.8 11.9 11.8
boxplot(data$infant.deaths)
boxplot(data$infant.deaths)$stats[5]

## [1] 53
kable(t(head(data[data$infant.deaths > 200, ])))
564 565 566 567 568 569
Country China China China China China China
Year 2012 2011 2010 2009 2008 2007
Status Developing Developing Developing Developing Developing Developing
Life.expectancy 75.4 75.2 75.0 74.9 74.5 74.4
Adult.Mortality 89 91 92 93 97 96
infant.deaths 201 215 231 248 266 285
Alcohol 5.74 5.63 5.75 4.88 4.27 3.88
percentage.expenditure 94.434 91.267 5.661 50.283 39.225 312.662
Hepatitis.B 99 99 99 99 95 92
Measles 6183 9943 38159 52461 131441 109023
BMI 3.0 29.0 28.1 27.3 26.5 25.7
under.five.deaths 233 251 268 288 308 332
Polio 99 99 99 99 99 94
Total.expenditure 5.26 5.30 4.89 5.80 4.59 4.32
Diphtheria 99 99 99 99 97 93
HIV.AIDS 0.1 0.1 0.1 0.1 0.1 0.1
GDP 6337.9 5633.8 456.5 3838.4 3471.2 2695.4
Population 135695 134413 133775 133126 1324655 1317885
thinness..1.19.years 3.9 4.1 4.2 4.4 4.5 4.7
thinness.5.9.years 3.3 3.5 3.6 3.8 4.0 4.1
Income.composition.of.resources 0.703 0.700 0.691 0.682 0.672 0.659
Schooling 12.4 12.8 12.5 12.2 11.9 11.4
boxplot(data$Measles)
kable(t(head(data[data$Measles > boxplot(data$Measles)$stats[5], ])))

1 4 5 6 7 8
Country Afghanistan Afghanistan Afghanistan Afghanistan Afghanistan Afghanistan
Year 2015 2012 2011 2010 2009 2008
Status Developing Developing Developing Developing Developing Developing
Life.expectancy 65.0 59.5 59.2 58.8 58.6 58.1
Adult.Mortality 263 272 275 279 281 287
infant.deaths 62 69 71 74 77 80
Alcohol 0.01 0.01 0.01 0.01 0.01 0.03
percentage.expenditure 71.280 78.184 7.097 79.679 56.762 25.874
Hepatitis.B 65 67 68 66 63 64
Measles 1154 2787 3013 1989 2861 1599
BMI 19.1 17.6 17.2 16.7 16.2 15.7
under.five.deaths 83 93 97 102 106 110
Polio 6 67 68 66 63 64
Total.expenditure 8.16 8.52 7.87 9.20 9.42 8.33
Diphtheria 65 67 68 66 63 64
HIV.AIDS 0.1 0.1 0.1 0.1 0.1 0.1
GDP 584.26 669.96 63.54 553.33 445.89 373.36
Population 33736494 3696958 2978599 2883167 284331 2729431
thinness..1.19.years 17.2 17.9 18.2 18.4 18.6 18.8
thinness.5.9.years 17.3 18.0 18.2 18.4 18.7 18.9
Income.composition.of.resources 0.479 0.463 0.454 0.448 0.434 0.433
Schooling 10.1 9.8 9.5 9.2 8.9 8.7
boxplot(data$under.five.deaths)
kable(t(head(data[data$under.five.deaths > boxplot(data$under.five.deaths)$stats[5], ])))

1 2 3 4 5 6
Country Afghanistan Afghanistan Afghanistan Afghanistan Afghanistan Afghanistan
Year 2015 2014 2013 2012 2011 2010
Status Developing Developing Developing Developing Developing Developing
Life.expectancy 65.0 59.9 59.9 59.5 59.2 58.8
Adult.Mortality 263 271 268 272 275 279
infant.deaths 62 64 66 69 71 74
Alcohol 0.01 0.01 0.01 0.01 0.01 0.01
percentage.expenditure 71.280 73.524 73.219 78.184 7.097 79.679
Hepatitis.B 65 62 64 67 68 66
Measles 1154 492 430 2787 3013 1989
BMI 19.1 18.6 18.1 17.6 17.2 16.7
under.five.deaths 83 86 89 93 97 102
Polio 6 58 62 67 68 66
Total.expenditure 8.16 8.18 8.13 8.52 7.87 9.20
Diphtheria 65 62 64 67 68 66
HIV.AIDS 0.1 0.1 0.1 0.1 0.1 0.1
GDP 584.26 612.70 631.74 669.96 63.54 553.33
Population 33736494 327582 31731688 3696958 2978599 2883167
thinness..1.19.years 17.2 17.5 17.7 17.9 18.2 18.4
thinness.5.9.years 17.3 17.5 17.7 18.0 18.2 18.4
Income.composition.of.resources 0.479 0.476 0.470 0.463 0.454 0.448
Schooling 10.1 10.0 9.9 9.8 9.5 9.2
ggplot(gather(data[-c(1, 3)]), aes(value)) + 
    geom_histogram(bins = 10) + 
    facet_wrap(~key, scales = 'free_x')

ggplot(data, aes(x = Status, y = Life.expectancy)) + geom_boxplot()

ggplot(data, aes(x = Adult.Mortality, y = Life.expectancy)) + geom_boxplot()
## Warning: Continuous x aesthetic -- did you forget aes(group=...)?

This original dataset contains Country variable which we would not use for model building. Therefore, this column is excluded from the following data analysis as well as the records with NA in some of the columns mentioned above. This will reduce the size of the original dataset from 2938 to 1649 rows, which captures majority of the information and allows the speed of modeling to be more efficient.

Below lists the summary and structure of the cleaned dataset.

summary(data)
##         Country          Year             Status     Life.expectancy
##  Afghanistan:  16   Min.   :2000   Developed : 242   Min.   :44.0   
##  Albania    :  16   1st Qu.:2005   Developing:1407   1st Qu.:64.4   
##  Armenia    :  15   Median :2008                     Median :71.7   
##  Austria    :  15   Mean   :2008                     Mean   :69.3   
##  Belarus    :  15   3rd Qu.:2011                     3rd Qu.:75.0   
##  Belgium    :  15   Max.   :2015                     Max.   :89.0   
##  (Other)    :1557                                                   
##  Adult.Mortality infant.deaths       Alcohol      percentage.expenditure
##  Min.   :  1     Min.   :   0.0   Min.   : 0.01   Min.   :    0         
##  1st Qu.: 77     1st Qu.:   1.0   1st Qu.: 0.81   1st Qu.:   37         
##  Median :148     Median :   3.0   Median : 3.79   Median :  145         
##  Mean   :168     Mean   :  32.6   Mean   : 4.53   Mean   :  699         
##  3rd Qu.:227     3rd Qu.:  22.0   3rd Qu.: 7.34   3rd Qu.:  509         
##  Max.   :723     Max.   :1600.0   Max.   :17.87   Max.   :18961         
##                                                                         
##   Hepatitis.B      Measles            BMI       under.five.deaths
##  Min.   : 2.0   Min.   :     0   Min.   : 2.0   Min.   :   0.0   
##  1st Qu.:74.0   1st Qu.:     0   1st Qu.:19.5   1st Qu.:   1.0   
##  Median :89.0   Median :    15   Median :43.7   Median :   4.0   
##  Mean   :79.2   Mean   :  2224   Mean   :38.1   Mean   :  44.2   
##  3rd Qu.:96.0   3rd Qu.:   373   3rd Qu.:55.8   3rd Qu.:  29.0   
##  Max.   :99.0   Max.   :131441   Max.   :77.1   Max.   :2100.0   
##                                                                  
##      Polio      Total.expenditure   Diphtheria      HIV.AIDS    
##  Min.   : 3.0   Min.   : 0.74     Min.   : 2.0   Min.   : 0.10  
##  1st Qu.:81.0   1st Qu.: 4.41     1st Qu.:82.0   1st Qu.: 0.10  
##  Median :93.0   Median : 5.84     Median :92.0   Median : 0.10  
##  Mean   :83.6   Mean   : 5.96     Mean   :84.2   Mean   : 1.98  
##  3rd Qu.:97.0   3rd Qu.: 7.47     3rd Qu.:97.0   3rd Qu.: 0.70  
##  Max.   :99.0   Max.   :14.39     Max.   :99.0   Max.   :50.60  
##                                                                 
##       GDP           Population       thinness..1.19.years thinness.5.9.years
##  Min.   :     2   Min.   :3.40e+01   Min.   : 0.10        Min.   : 0.10     
##  1st Qu.:   462   1st Qu.:1.92e+05   1st Qu.: 1.60        1st Qu.: 1.70     
##  Median :  1593   Median :1.42e+06   Median : 3.00        Median : 3.20     
##  Mean   :  5566   Mean   :1.47e+07   Mean   : 4.85        Mean   : 4.91     
##  3rd Qu.:  4719   3rd Qu.:7.66e+06   3rd Qu.: 7.10        3rd Qu.: 7.10     
##  Max.   :119173   Max.   :1.29e+09   Max.   :27.20        Max.   :28.20     
##                                                                             
##  Income.composition.of.resources   Schooling   
##  Min.   :0.000                   Min.   : 4.2  
##  1st Qu.:0.509                   1st Qu.:10.3  
##  Median :0.673                   Median :12.3  
##  Mean   :0.632                   Mean   :12.1  
##  3rd Qu.:0.751                   3rd Qu.:14.0  
##  Max.   :0.936                   Max.   :20.7  
## 
data = na.omit(data)
data = data[-1] #exclude country from dataset
str(data)
## 'data.frame':    1649 obs. of  21 variables:
##  $ Year                           : int  2015 2014 2013 2012 2011 2010 2009 2008 2007 2006 ...
##  $ Status                         : Factor w/ 2 levels "Developed","Developing": 2 2 2 2 2 2 2 2 2 2 ...
##  $ Life.expectancy                : num  65 59.9 59.9 59.5 59.2 58.8 58.6 58.1 57.5 57.3 ...
##  $ Adult.Mortality                : int  263 271 268 272 275 279 281 287 295 295 ...
##  $ infant.deaths                  : int  62 64 66 69 71 74 77 80 82 84 ...
##  $ Alcohol                        : num  0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.03 0.02 0.03 ...
##  $ percentage.expenditure         : num  71.3 73.5 73.2 78.2 7.1 ...
##  $ Hepatitis.B                    : int  65 62 64 67 68 66 63 64 63 64 ...
##  $ Measles                        : int  1154 492 430 2787 3013 1989 2861 1599 1141 1990 ...
##  $ BMI                            : num  19.1 18.6 18.1 17.6 17.2 16.7 16.2 15.7 15.2 14.7 ...
##  $ under.five.deaths              : int  83 86 89 93 97 102 106 110 113 116 ...
##  $ Polio                          : int  6 58 62 67 68 66 63 64 63 58 ...
##  $ Total.expenditure              : num  8.16 8.18 8.13 8.52 7.87 9.2 9.42 8.33 6.73 7.43 ...
##  $ Diphtheria                     : int  65 62 64 67 68 66 63 64 63 58 ...
##  $ HIV.AIDS                       : num  0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 ...
##  $ GDP                            : num  584.3 612.7 631.7 670 63.5 ...
##  $ Population                     : num  33736494 327582 31731688 3696958 2978599 ...
##  $ thinness..1.19.years           : num  17.2 17.5 17.7 17.9 18.2 18.4 18.6 18.8 19 19.2 ...
##  $ thinness.5.9.years             : num  17.3 17.5 17.7 18 18.2 18.4 18.7 18.9 19.1 19.3 ...
##  $ Income.composition.of.resources: num  0.479 0.476 0.47 0.463 0.454 0.448 0.434 0.433 0.415 0.405 ...
##  $ Schooling                      : num  10.1 10 9.9 9.8 9.5 9.2 8.9 8.7 8.4 8.1 ...

Data Visualization

Let’s take a look of the dataset using plots of Life Expectancy vs Status or Year. The boxplot indicates that there is significant difference in Life Expectancy between the Developed and Developing countries. As expected, the Life Expectancy increases as the Year passes by and the Violin plot shows that the data is well distributed across different years.

par(mfrow=c(1,2))
# Histogram of Life Expectancy
hist(data$Life.expectancy,
     xlab = "Life Expectancy",
     main = "Distribution of Life Expectancy",
     col = "dodgerblue",
     breaks = 25)
# Boxplot of Life Expectancy vs Country Status (Developed vs Developing)
plot(data$Status,
     data$Life.expectancy,
     xlab = "Status",
     ylab = "Life Expectancy",
     main = "Life Expectancy vs. Status",
     col = c(2,3))

# Violin plot of Life Expectancy vs. Year
data %>% ggplot() + geom_violin(aes(x=Year, y=Life.expectancy, group=Year, fill=Year)) + labs(title = "Life Expectancy vs. Year")

Colinearity

Colinearity issue is visualized using the following plots. Resulsts show that some predictors have strong collinearity issues, such as infant.deaths vs. under.five.deaths, GDP vs. percentage.expenditure, Population vs. thinness..1.19.years etc.

corrplot(cor(data[-c(2)]), method = "circle")

ggpairs(data[-c(2)])

round(cor(data[-c(2)]),2)
##                                  Year Life.expectancy Adult.Mortality
## Year                             1.00            0.05           -0.04
## Life.expectancy                  0.05            1.00           -0.70
## Adult.Mortality                 -0.04           -0.70            1.00
## infant.deaths                    0.01           -0.17            0.04
## Alcohol                         -0.11            0.40           -0.18
## percentage.expenditure           0.07            0.41           -0.24
## Hepatitis.B                      0.11            0.20           -0.11
## Measles                         -0.05           -0.07            0.00
## BMI                              0.01            0.54           -0.35
## under.five.deaths                0.01           -0.19            0.06
## Polio                           -0.02            0.33           -0.20
## Total.expenditure                0.06            0.17           -0.09
## Diphtheria                       0.03            0.34           -0.19
## HIV.AIDS                        -0.12           -0.59            0.55
## GDP                              0.10            0.44           -0.26
## Population                       0.01           -0.02           -0.02
## thinness..1.19.years             0.02           -0.46            0.27
## thinness.5.9.years               0.01           -0.46            0.29
## Income.composition.of.resources  0.12            0.72           -0.44
## Schooling                        0.09            0.73           -0.42
##                                 infant.deaths Alcohol percentage.expenditure
## Year                                     0.01   -0.11                   0.07
## Life.expectancy                         -0.17    0.40                   0.41
## Adult.Mortality                          0.04   -0.18                  -0.24
## infant.deaths                            1.00   -0.11                  -0.09
## Alcohol                                 -0.11    1.00                   0.42
## percentage.expenditure                  -0.09    0.42                   1.00
## Hepatitis.B                             -0.23    0.11                   0.02
## Measles                                  0.53   -0.05                  -0.06
## BMI                                     -0.23    0.35                   0.24
## under.five.deaths                        1.00   -0.10                  -0.09
## Polio                                   -0.16    0.24                   0.13
## Total.expenditure                       -0.15    0.21                   0.18
## Diphtheria                              -0.16    0.24                   0.13
## HIV.AIDS                                 0.01   -0.03                  -0.10
## GDP                                     -0.10    0.44                   0.96
## Population                               0.67   -0.03                  -0.02
## thinness..1.19.years                     0.46   -0.40                  -0.26
## thinness.5.9.years                       0.46   -0.39                  -0.26
## Income.composition.of.resources         -0.13    0.56                   0.40
## Schooling                               -0.21    0.62                   0.42
##                                 Hepatitis.B Measles   BMI under.five.deaths
## Year                                   0.11   -0.05  0.01              0.01
## Life.expectancy                        0.20   -0.07  0.54             -0.19
## Adult.Mortality                       -0.11    0.00 -0.35              0.06
## infant.deaths                         -0.23    0.53 -0.23              1.00
## Alcohol                                0.11   -0.05  0.35             -0.10
## percentage.expenditure                 0.02   -0.06  0.24             -0.09
## Hepatitis.B                            1.00   -0.12  0.14             -0.24
## Measles                               -0.12    1.00 -0.15              0.52
## BMI                                    0.14   -0.15  1.00             -0.24
## under.five.deaths                     -0.24    0.52 -0.24              1.00
## Polio                                  0.46   -0.06  0.19             -0.17
## Total.expenditure                      0.11   -0.11  0.19             -0.15
## Diphtheria                             0.59   -0.06  0.18             -0.18
## HIV.AIDS                              -0.09    0.00 -0.21              0.02
## GDP                                    0.04   -0.06  0.27             -0.10
## Population                            -0.13    0.32 -0.08              0.66
## thinness..1.19.years                  -0.13    0.18 -0.55              0.46
## thinness.5.9.years                    -0.13    0.17 -0.55              0.46
## Income.composition.of.resources        0.18   -0.06  0.51             -0.15
## Schooling                              0.22   -0.12  0.55             -0.23
##                                 Polio Total.expenditure Diphtheria HIV.AIDS
## Year                            -0.02              0.06       0.03    -0.12
## Life.expectancy                  0.33              0.17       0.34    -0.59
## Adult.Mortality                 -0.20             -0.09      -0.19     0.55
## infant.deaths                   -0.16             -0.15      -0.16     0.01
## Alcohol                          0.24              0.21       0.24    -0.03
## percentage.expenditure           0.13              0.18       0.13    -0.10
## Hepatitis.B                      0.46              0.11       0.59    -0.09
## Measles                         -0.06             -0.11      -0.06     0.00
## BMI                              0.19              0.19       0.18    -0.21
## under.five.deaths               -0.17             -0.15      -0.18     0.02
## Polio                            1.00              0.12       0.61    -0.11
## Total.expenditure                0.12              1.00       0.13     0.04
## Diphtheria                       0.61              0.13       1.00    -0.12
## HIV.AIDS                        -0.11              0.04      -0.12     1.00
## GDP                              0.16              0.18       0.16    -0.11
## Population                      -0.05             -0.08      -0.04    -0.03
## thinness..1.19.years            -0.16             -0.21      -0.19     0.17
## thinness.5.9.years              -0.17             -0.22      -0.18     0.18
## Income.composition.of.resources  0.31              0.18       0.34    -0.25
## Schooling                        0.35              0.24       0.35    -0.21
##                                   GDP Population thinness..1.19.years
## Year                             0.10       0.01                 0.02
## Life.expectancy                  0.44      -0.02                -0.46
## Adult.Mortality                 -0.26      -0.02                 0.27
## infant.deaths                   -0.10       0.67                 0.46
## Alcohol                          0.44      -0.03                -0.40
## percentage.expenditure           0.96      -0.02                -0.26
## Hepatitis.B                      0.04      -0.13                -0.13
## Measles                         -0.06       0.32                 0.18
## BMI                              0.27      -0.08                -0.55
## under.five.deaths               -0.10       0.66                 0.46
## Polio                            0.16      -0.05                -0.16
## Total.expenditure                0.18      -0.08                -0.21
## Diphtheria                       0.16      -0.04                -0.19
## HIV.AIDS                        -0.11      -0.03                 0.17
## GDP                              1.00      -0.02                -0.28
## Population                      -0.02       1.00                 0.28
## thinness..1.19.years            -0.28       0.28                 1.00
## thinness.5.9.years              -0.28       0.28                 0.93
## Income.composition.of.resources  0.45      -0.01                -0.45
## Schooling                        0.47      -0.04                -0.49
##                                 thinness.5.9.years
## Year                                          0.01
## Life.expectancy                              -0.46
## Adult.Mortality                               0.29
## infant.deaths                                 0.46
## Alcohol                                      -0.39
## percentage.expenditure                       -0.26
## Hepatitis.B                                  -0.13
## Measles                                       0.17
## BMI                                          -0.55
## under.five.deaths                             0.46
## Polio                                        -0.17
## Total.expenditure                            -0.22
## Diphtheria                                   -0.18
## HIV.AIDS                                      0.18
## GDP                                          -0.28
## Population                                    0.28
## thinness..1.19.years                          0.93
## thinness.5.9.years                            1.00
## Income.composition.of.resources              -0.44
## Schooling                                    -0.47
##                                 Income.composition.of.resources Schooling
## Year                                                       0.12      0.09
## Life.expectancy                                            0.72      0.73
## Adult.Mortality                                           -0.44     -0.42
## infant.deaths                                             -0.13     -0.21
## Alcohol                                                    0.56      0.62
## percentage.expenditure                                     0.40      0.42
## Hepatitis.B                                                0.18      0.22
## Measles                                                   -0.06     -0.12
## BMI                                                        0.51      0.55
## under.five.deaths                                         -0.15     -0.23
## Polio                                                      0.31      0.35
## Total.expenditure                                          0.18      0.24
## Diphtheria                                                 0.34      0.35
## HIV.AIDS                                                  -0.25     -0.21
## GDP                                                        0.45      0.47
## Population                                                -0.01     -0.04
## thinness..1.19.years                                      -0.45     -0.49
## thinness.5.9.years                                        -0.44     -0.47
## Income.composition.of.resources                            1.00      0.78
## Schooling                                                  0.78      1.00
# train test split 70/30 hold out
train_size = floor(0.7 * nrow(data))
train_idx = sample(nrow(data), train_size)
data.train = data[train_idx, ]
data.test = data[-train_idx, ]


model.additive = lm(Life.expectancy ~ ., data.train)
cv.lm(data.train, model.additive, m = 5, plotit = FALSE)
## Analysis of Variance Table
## 
## Response: Life.expectancy
##                                   Df Sum Sq Mean Sq F value  Pr(>F)    
## Year                               1    417     417   33.63 8.6e-09 ***
## Status                             1  17517   17517 1411.46 < 2e-16 ***
## Adult.Mortality                    1  28083   28083 2262.80 < 2e-16 ***
## infant.deaths                      1   1105    1105   89.04 < 2e-16 ***
## Alcohol                            1   2219    2219  178.78 < 2e-16 ***
## percentage.expenditure             1   1108    1108   89.29 < 2e-16 ***
## Hepatitis.B                        1    814     814   65.58 1.4e-15 ***
## Measles                            1     16      16    1.27  0.2602    
## BMI                                1   3647    3647  293.86 < 2e-16 ***
## under.five.deaths                  1   2628    2628  211.79 < 2e-16 ***
## Polio                              1    791     791   63.74 3.5e-15 ***
## Total.expenditure                  1     13      13    1.06  0.3023    
## Diphtheria                         1    405     405   32.59 1.4e-08 ***
## HIV.AIDS                           1   6607    6607  532.33 < 2e-16 ***
## GDP                                1    209     209   16.83 4.4e-05 ***
## Population                         1     24      24    1.90  0.1683    
## thinness..1.19.years               1    121     121    9.75  0.0018 ** 
## thinness.5.9.years                 1     29      29    2.32  0.1279    
## Income.composition.of.resources    1   4467    4467  359.93 < 2e-16 ***
## Schooling                          1   1997    1997  160.92 < 2e-16 ***
## Residuals                       1133  14061      12                    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## fold 1 
## Observations in test set: 230 
##                   2275  2699  2124   834   2276  2697   884  1289  2160  1354
## Predicted       73.700 68.50 75.89 70.28 73.581 71.27 60.77 80.46 61.10 72.48
## cvpred          73.897 68.54 75.68 70.38 73.758 71.28 60.66 80.41 61.08 72.55
## Life.expectancy 73.600 66.00 74.30 69.00 73.000 74.00 64.20 81.60 59.60 66.60
## CV residual     -0.297 -2.54 -1.38 -1.38 -0.758  2.72  3.54  1.19 -1.48 -5.95
##                  1727  1140   1295  1590    508  1629 1366 2043  2258   688
## Predicted       69.21 68.40 80.310 72.45 79.657 60.47 63.4 76.5 63.58 75.52
## cvpred          69.25 68.49 80.227 72.53 79.887 60.42 63.4 76.5 63.82 75.39
## Life.expectancy 64.50 74.50 79.900 74.50 80.000 53.60 62.1 76.8 62.10 78.20
## CV residual     -4.75  6.01 -0.327  1.97  0.113 -6.82 -1.3  0.3 -1.72  2.81
##                  2709   2694  2855   1337  1348    824   283   392  1110  1721
## Predicted       60.68 71.991 62.56 73.496 75.80 71.337 59.42 74.35 70.25 72.47
## cvpred          60.23 72.081 62.17 73.655 75.91 71.447 59.38 74.25 70.34 72.53
## Life.expectancy 63.50 71.600 69.40 73.300 69.90 72.000 56.50 72.90 65.80 67.30
## CV residual      3.27 -0.481  7.23 -0.355 -6.01  0.553 -2.88 -1.35 -4.54 -5.23
##                  277  1979   299   92  1826  1002  1193   779   2206  2064
## Predicted       62.8 64.33 59.47 79.1 67.63 83.36 69.05 69.11 72.107 77.22
## cvpred          62.7 64.32 58.97 79.2 67.44 83.09 69.46 69.16 72.238 77.16
## Life.expectancy 59.1 62.20 65.00 74.7 64.30 79.90 66.00 72.90 72.600 78.70
## CV residual     -3.6 -2.12  6.03 -4.5 -3.14 -3.19 -3.46  3.74  0.362  1.54
##                  1493  2257  118   265    361  1963  1772   388  2852   634
## Predicted       63.37 61.33 86.4 70.92 73.824 74.12 58.97 75.05 68.35 73.70
## cvpred          63.36 61.25 86.4 71.01 74.032 74.32 58.99 74.94 68.35 73.89
## Life.expectancy 61.10 62.80 81.9 69.60 73.300 77.20 53.20 73.90 71.00 78.90
## CV residual     -2.26  1.55 -4.5 -1.41 -0.732  2.88 -5.79 -1.04  2.65  5.01
##                   1674    2928  2572  602   1682   300   203   474    826 2144
## Predicted       71.825 52.3495 71.71 64.2 70.651 58.10 64.26 62.96 71.769 71.0
## cvpred          71.867 52.3136 71.72 64.1 70.656 57.51 64.73 62.84 71.851 71.1
## Life.expectancy 72.800 52.4000 74.50 63.0 71.500 64.20 67.80 64.10 71.700 67.3
## CV residual      0.933  0.0864  2.78 -1.1  0.844  6.69  3.07  1.26 -0.151 -3.8
##                  1966 1288  1723  2817   796   204    83      230  2931   2029
## Predicted       73.00 82.9 71.17 75.03 72.42 65.25 77.50 72.91735 54.55 68.104
## cvpred          73.18 82.9 71.22 75.16 72.52 65.19 77.67 73.00934 54.63 67.735
## Life.expectancy 76.80 81.8 66.90 76.60 74.40 67.30 76.00 73.00000 46.60 67.900
## CV residual      3.62 -1.1 -4.32  1.44  1.88  2.11 -1.67 -0.00934 -8.03  0.165
##                   147  1022  1768  2725   427  2829  2002   293  547   2228
## Predicted       70.54 63.16 62.13 55.37 54.95 70.62 70.88 67.32 77.2 64.754
## cvpred          70.68 63.23 62.15 55.44 54.88 70.72 70.96 67.19 77.3 64.591
## Life.expectancy 72.20 58.30 54.80 53.20 53.40 69.10 72.10 68.30 81.0 64.300
## CV residual      1.52 -4.93 -7.35 -2.24 -1.48 -1.62  1.14  1.11  3.7 -0.291
##                   1618   134  1967  1615  1997  2737  1970  1216     8   1532
## Predicted       70.025 81.03 72.96 70.61 71.17 72.36 72.19 66.59 61.72 75.759
## cvpred          70.017 81.04 73.12 70.57 71.33 72.51 72.31 66.55 61.67 75.586
## Life.expectancy 69.600 84.00 76.50 72.70 73.20 69.20 75.80 66.70 58.10 76.000
## CV residual     -0.417  2.96  3.38  2.13  1.87 -3.31  3.49  0.15 -3.57  0.414
##                  1336   421   1777   862   235   2033    394   1465  1150  2692
## Predicted       74.55 61.47 50.148 53.74 72.15 68.152 72.650 74.004 68.57 70.46
## cvpred          74.75 61.39 50.004 53.31 72.25 67.836 72.447 74.177 68.66 70.56
## Life.expectancy 73.40 57.40 51.000 59.10 68.10 67.300 72.200 74.700 72.20 72.40
## CV residual     -1.35 -3.99  0.996  5.79 -4.15 -0.536 -0.247  0.523  3.54  1.84
##                   2733   908  1191   133   279    592    18   272  2679  886
## Predicted       71.177 72.73 61.96 80.70 61.70 70.930 75.68 69.45 75.27 59.3
## cvpred          71.271 72.79 62.35 80.46 61.53 71.024 75.84 69.44 75.33 59.2
## Life.expectancy 71.000 68.50 66.80 88.00 58.40 71.400 77.50 68.30 73.50 63.3
## CV residual     -0.271 -4.29  4.45  7.54 -3.13  0.376  1.66 -1.14 -1.83  4.1
##                   462   909   864  1534  2291   681   1242    87  2585    1952
## Predicted       69.15 72.68 51.58 78.19 70.26 76.33 69.053 77.32 68.43 64.1776
## cvpred          69.12 72.74 51.27 77.93 70.23 76.26 69.099 77.51 68.35 64.2184
## Life.expectancy 77.00 68.30 58.50 71.60 72.20 79.10 69.300 75.60 71.10 64.2000
## CV residual      7.88 -4.44  7.23 -6.33  1.97  2.84  0.201 -1.91  2.75 -0.0184
##                  833   567  1531   1541  2133   1125   126    872  1544  2059
## Predicted       70.5 73.98 79.43 82.134 72.32 63.352 83.49 76.162 77.47 78.04
## cvpred          70.6 73.98 79.29 82.142 72.08 63.387 83.44 76.334 77.43 78.01
## Life.expectancy 68.9 74.90 72.00 81.400 77.00 62.700 79.90 75.600 86.00 83.00
## CV residual     -1.7  0.92 -7.29 -0.742  4.92 -0.687 -3.54 -0.734  8.57  4.99
##                    795   2658   359     1  2149      36  2910  1642 2850   2812
## Predicted       74.361 70.032 74.05 62.79 70.33 74.8984 61.83 78.31 68.5 76.002
## cvpred          74.485 70.021 74.15 62.67 70.43 75.0195 61.73 78.29 68.5 76.333
## Life.expectancy 74.700 69.700 73.60 65.00 64.80 75.1000 59.20 80.00 75.0 76.800
## CV residual      0.215 -0.321 -0.55  2.33 -5.63  0.0805 -2.53  1.71  6.5  0.467
##                  1832   2155 2577 1626   237  1627  1237   458   1393  1497
## Predicted       83.65 65.239 71.0 57.1 69.52 57.61 70.73 69.55 64.022 63.07
## cvpred          84.04 65.218 70.9 57.0 69.68 57.57 70.82 69.52 63.787 63.17
## Life.expectancy 81.40 64.600 73.5 55.5 67.70 55.00 69.50 72.10 64.300 59.20
## CV residual     -2.64 -0.618  2.6 -1.5 -1.98 -2.57 -1.32  2.58  0.513 -3.97
##                    470   1189  2025    507  1207    14  1551  1895   536   266
## Predicted       66.161 67.958 67.71 81.642 70.39 62.24 81.23 52.20 51.94 70.67
## cvpred          66.081 68.375 67.18 81.924 70.36 62.84 81.18 52.19 51.77 70.73
## Life.expectancy 66.600 67.600 68.40 81.000 68.30 56.20 78.60 53.60 49.60 69.40
## CV residual      0.519 -0.775  1.22 -0.924 -2.06 -6.64 -2.58  1.41 -2.17 -1.33
##                 2395   364  2638   2475    22  2619    350   367 2702  2856
## Predicted       65.3 76.65 75.98 71.013 72.76 64.85 45.073 74.87 68.3 61.15
## cvpred          65.4 76.72 76.11 71.139 72.88 64.75 45.265 75.04 68.3 60.82
## Life.expectancy 62.0 72.00 72.90 71.400 76.20 59.70 46.000 71.00 65.6 69.30
## CV residual     -3.4 -4.72 -3.21  0.261  3.32 -5.05  0.735 -4.04 -2.7  8.48
##                  1819  1616   550   301   244  2558   352   110   138  2128
## Predicted       66.72 70.42 74.45 58.68 78.13 69.11 43.98 70.89 76.30 74.84
## cvpred          66.63 70.36 74.58 58.18 77.92 69.16 44.17 70.97 76.05 74.64
## Life.expectancy 68.00 71.80 79.10 63.30 83.00 68.10 47.80 72.60 79.80 72.90
## CV residual      1.37  1.44  4.52  5.12  5.08 -1.06  3.63  1.63  3.75 -1.74
##                  1565   2494  1631  1000  2640   2031     39   1287   1833
## Predicted       62.49 55.606 55.49 83.00 74.24 68.687 73.427 82.908 81.258
## cvpred          62.33 55.688 55.45 82.98 74.35 68.407 73.535 82.863 81.584
## Life.expectancy 69.00 55.000 52.00 81.00 72.50 67.500 74.400 82.000 81.100
## CV residual      6.67 -0.688 -3.45 -1.98 -1.85 -0.907  0.865 -0.863 -0.484
##                   597    137  1582   2652   2606   2832  1141  2165   387
## Predicted       65.34 80.946 47.16 71.049 68.072 69.123 72.09 53.80 76.65
## cvpred          65.28 80.699 47.23 71.173 67.913 69.149 72.24 53.63 76.61
## Life.expectancy 62.20 81.000 45.10 71.000 67.200 68.300 74.30 57.00 74.10
## CV residual     -3.08  0.301 -2.13 -0.173 -0.713 -0.849  2.06  3.37 -2.51
##                   2401   2555   911    13  1274     37    472  2145   786  2001
## Predicted       53.963 69.339 75.15 58.81 79.22 74.418 66.065 75.33 69.65 70.77
## cvpred          54.457 69.409 75.21 58.75 79.69 74.516 65.958 75.43 69.72 70.84
## Life.expectancy 55.300 69.600 68.00 56.70 81.00 74.900 65.600 66.40 72.00 72.30
## CV residual      0.843  0.191 -7.21 -2.05  1.31  0.384 -0.358 -9.03  2.28  1.46
##                   2657   2603   632   901  2402  1290 2367  1646   489  2834
## Predicted       69.345 68.817 73.26 73.83 52.44 79.61 65.0 77.60 55.95 70.36
## cvpred          69.548 68.382 73.41 73.92 52.59 79.53 65.2 77.54 55.91 70.43
## Life.expectancy 69.900 68.000 79.20 69.60 54.50 81.50 68.3 78.70 53.60 67.90
## CV residual      0.352 -0.382  5.79 -4.32  1.91  1.97  3.1  1.16 -2.31 -2.53
##                   2289  2840   197   2013  1015   1018  1689   243  531    12
## Predicted       71.527 70.02 68.17 74.349 65.12 63.509 71.85 77.94 55.0 58.18
## cvpred          71.557 70.06 67.96 74.442 65.09 63.486 71.91 77.74 54.9 58.11
## Life.expectancy 72.200 67.10 73.00 73.700 61.20 63.000 75.60 87.00 52.2 57.00
## CV residual      0.643 -2.96  5.04 -0.742 -3.89 -0.486  3.69  9.26 -2.7 -1.11
##                   1614   2204
## Predicted       72.478 72.459
## cvpred          72.448 72.602
## Life.expectancy 73.400 73.200
## CV residual      0.952  0.598
## 
## Sum of squares = 2534    Mean square = 11    n = 230 
## 
## fold 2 
## Observations in test set: 231 
##                   1108  2718  1609  2297  2933  2015  2405   2429  1677   605
## Predicted       66.501 60.07 71.21 64.03 41.71 70.99 51.02 81.819 72.16 57.57
## cvpred          66.421 60.07 71.01 62.68 41.89 71.21 50.88 81.648 72.17 56.96
## Life.expectancy 66.000 60.00 76.30 71.80 44.60 73.90 53.70 82.000 71.80 59.60
## CV residual     -0.421 -0.07  5.29  9.12  2.71  2.69  2.82  0.352 -0.37  2.64
##                  2447   1740  1243    139    146  1696  1673  2736  2163  1718
## Predicted       71.79 74.895 67.83 79.035 72.568 73.36 71.62 72.12 55.68 72.90
## cvpred          71.79 74.814 68.05 79.026 72.665 73.32 71.82 72.05 55.47 73.01
## Life.expectancy 74.50 74.600 65.90 79.400 72.500 75.00 73.30 69.80 53.40 68.40
## CV residual      2.71 -0.214 -2.15  0.374 -0.165  1.68  1.48 -2.25 -2.07 -4.61
##                  2365 2434  466  242   1690    468   1281   777  1962  2707
## Predicted       66.65   79 67.3 80.7 75.191 66.555 78.393 71.25 72.13 61.35
## cvpred          66.59   79 67.2 80.6 75.068 66.506 78.525 71.31 72.23 60.35
## Life.expectancy 68.70   89 68.3 89.0 75.700 67.400 79.300 73.60 77.50 63.70
## CV residual      2.11   10  1.1  8.4  0.632  0.894  0.775  2.29  5.27  3.35
##                     43   583 1530 1358   461   1114  1462  1154  1904  1094
## Predicted       71.821 74.24 76.7 70.7 68.84 66.493 74.08 67.73 50.45 60.16
## cvpred          71.973 74.11 76.6 70.8 68.73 66.515 74.01 67.69 49.69 60.07
## Life.expectancy 72.900 73.60 71.1 64.7 71.10 66.300 75.00 71.00 49.20 57.60
## CV residual      0.927 -0.51 -5.5 -6.1  2.37 -0.215  0.99  3.31 -0.49 -2.47
##                  1357  1903  1686   534   2222  1974   989  1756   1255  2061
## Predicted       71.39 44.69 74.55 53.92 66.198 73.36 72.19 69.90 84.897 78.13
## cvpred          71.54 43.77 74.56 53.94 66.055 73.34 72.19 69.82 84.472 78.07
## Life.expectancy 64.60 49.80 76.60 51.20 66.600 75.50 73.90 71.80 84.000 79.60
## CV residual     -6.94  6.03  2.04 -2.74  0.545  2.16  1.71  1.98 -0.472  1.53
##                 1754   276   2296   345   1947  1239  1643   264  1280   263
## Predicted       71.9 61.32 71.172 59.48 65.960 68.85 78.19 71.03 77.65 71.05
## cvpred          71.7 61.43 71.172 59.53 66.357 68.94 78.18 70.98 77.71 70.98
## Life.expectancy 72.8 59.30 72.000 56.90 65.500 77.00 79.60 69.60 79.30 69.50
## CV residual      1.1 -2.13  0.828 -2.63 -0.857  8.06  1.42 -1.38  1.59 -1.48
##                   793  2445  2663  1244  1593  2065  1456   256  1527  2509
## Predicted       71.29 71.60 70.32 67.41 72.48 78.41 75.24 82.88 77.97 84.34
## cvpred          71.49 71.64 70.53 67.67 72.61 78.19 75.33 82.95 77.97 84.25
## Life.expectancy 75.10 74.50 69.20 64.70 74.00 78.50 73.00 77.60 72.80 81.70
## CV residual      3.61  2.86 -1.33 -2.97  1.39  0.31 -2.33 -5.35 -5.17 -2.55
##                    2284 1212   252  1605   902  1083   1793  1210  2123    130
## Predicted       72.8597 69.2 84.09 72.90 72.09 62.47 62.577 69.81 75.93 81.997
## cvpred          72.9713 69.7 83.83 72.69 72.34 62.23 62.659 70.33 75.99 81.671
## Life.expectancy 72.9000 67.3 78.80 77.90 69.40 56.40 63.200 67.70 74.40 81.400
## CV residual     -0.0713 -2.4 -5.03  5.21 -2.94 -5.83  0.541 -2.63 -1.59 -0.271
##                  1610   1338   282  1476  2443  1351     27  932  1538  1973
## Predicted       71.00 73.410 61.31 56.02 71.91 72.69 72.595 80.7 77.66 73.48
## cvpred          70.83 73.614 61.25 56.28 71.96 72.63 72.529 80.3 77.56 73.39
## Life.expectancy 75.90 73.100 56.80 52.10 74.70 68.50 73.500 82.2 71.60 75.70
## CV residual      5.07 -0.514 -4.45 -4.18  2.74 -4.13  0.971  1.9 -5.96  2.31
##                   868   933   589  1120   1464   686   390   119  2406  2831
## Predicted       78.67 80.85 73.52 66.89 74.453 76.13 74.60 85.42 51.15 70.32
## cvpred          78.73 80.44 73.43 66.81 74.395 76.27 74.68 85.19 51.02 70.37
## Life.expectancy 77.30 82.00 72.40 65.30 74.900 78.50 73.40 81.70 54.00 68.50
## CV residual     -1.43  1.56 -1.03 -1.51  0.505  2.23 -1.28 -3.49  2.98 -1.87
##                   953   878  1064   518   863   568  1213   2225   935   949
## Predicted       67.17 74.67 68.50 52.29 53.43 73.49 71.90 66.052 76.36 66.00
## cvpred          67.03 74.62 68.52 52.49 52.83 74.23 72.25 65.918 76.51 65.91
## Life.expectancy 61.70 72.30 77.00 49.20 58.80 74.50 67.20 65.400 81.70 64.60
## CV residual     -5.33 -2.32  8.48 -3.29  5.97  0.27 -5.05 -0.518  5.19 -1.31
##                   994  2624   857 1217  1284  2269   40   302  2689   501  2294
## Predicted       63.57 60.76 57.99 68.7 81.38 73.95 72.6 58.54 71.63 77.83 70.96
## cvpred          62.51 60.75 58.07 68.9 81.25 73.72 72.7 57.51 71.86 78.09 70.92
## Life.expectancy 71.80 56.70 61.40 66.5 82.50 74.90 74.1 62.50 73.50 81.50 72.10
## CV residual      9.29 -4.05  3.33 -2.4  1.25  1.18  1.4  4.99  1.64  3.41  1.18
##                  1573  1469   891  2499  2366  2207   1286  1872 1471   2695
## Predicted       59.04 67.34 57.99 40.15 66.56 71.29 82.711 68.88 70.1 71.695
## cvpred          59.16 66.11 57.58 40.35 66.46 71.42 82.554 68.85 68.6 71.791
## Life.expectancy 56.70 73.90 58.50 47.80 68.50 76.00 82.000 71.20 73.5 71.200
## CV residual     -2.46  7.79  0.92  7.45  2.04  4.58 -0.554  2.35  4.9 -0.591
##                   2909  2580  2563  2230  2550 1662  2607  1524   260  1385
## Predicted       63.264 69.79 68.28 65.67 69.58 62.1 68.22 76.81 70.58 73.53
## cvpred          63.332 69.82 68.35 65.43 69.57 62.2 68.33 76.66 70.52 73.17
## Life.expectancy 63.000 72.50 65.90 63.40 73.00 66.0 66.90 73.40 69.40 65.20
## CV residual     -0.332  2.68 -2.45 -2.03  3.43  3.8 -1.43 -3.26 -1.12 -7.97
##                   836  1981   759  2408  2644  1472   2370   2823   2686  2915
## Predicted       63.74 63.69 59.39 54.20 76.61 69.63 67.708 75.851 74.948 53.89
## cvpred          64.01 63.78 59.39 54.16 76.48 68.24 67.705 75.762 74.861 54.23
## Life.expectancy 57.90 61.80 61.30 56.00 72.30 73.20 67.600 75.400 74.500 52.60
## CV residual     -6.11 -1.98  1.91  1.84 -4.18  4.96 -0.105 -0.362 -0.361 -1.63
##                  2047   2156 1245   912  1977  1352 2407  2656   344    112
## Predicted       77.80 63.435 71.0 75.19 64.42 72.31 51.6 69.18 60.02 71.528
## cvpred          77.77 63.094 71.1 75.12 64.53 72.39 51.5 69.48 60.08 71.582
## Life.expectancy 75.50 63.800 66.8 67.90 62.70 67.80 54.9 71.00 57.50 72.000
## CV residual     -2.27  0.706 -4.3 -7.22 -1.83 -4.59  3.4  1.52 -2.58  0.418
##                   640  2565   985  239   2272  1063   2034   285   460  2853
## Predicted       75.03 68.43 71.75 71.3 73.844 68.22 67.786 60.37 70.58 62.76
## cvpred          75.09 68.49 71.89 71.1 73.606 68.27 67.951 60.31 70.33 61.85
## Life.expectancy 77.50 65.90 73.20 67.7 74.100 71.10 67.000 55.80 71.40 69.90
## CV residual      2.41 -2.59  1.31 -3.4  0.494  2.83 -0.951 -4.51  1.07  8.05
##                  1029  1870  2273  2676  2822  2051  2427  2058   1373  2932
## Predicted       79.70 69.36 72.54 75.83 77.05 77.20 81.30 77.72 54.696 52.56
## cvpred          79.37 69.28 72.53 75.64 76.83 77.25 81.56 77.77 54.768 52.27
## Life.expectancy 86.00 72.50 74.00 74.20 75.40 74.90 82.60 86.00 54.100 45.40
## CV residual      6.63  3.22  1.47 -1.44 -1.43 -2.35  1.04  8.23 -0.668 -6.87
##                  1479  1350  1563   678   1644   155   1549  1698  1097   483
## Predicted        63.7 71.59 63.30 77.70 78.712 70.83 78.328 72.82 58.13 60.86
## cvpred           63.3 71.71 63.31 77.51 78.651 71.01 78.407 72.87 58.13 60.91
## Life.expectancy  52.3 69.10 61.90 79.70 79.300 68.40 78.800 75.00 56.30 56.40
## CV residual     -11.0 -2.61 -1.41  2.19  0.649 -2.61  0.393  2.13 -1.83 -4.51
##                  1449   675 2641   820  2710  1545  2849   2288    829  2573
## Predicted       77.17 77.61 74.7 71.64 61.48 77.34 68.57 71.220 71.257 70.96
## cvpred          77.16 77.98 74.7 71.61 60.51 77.46 68.68 71.347 71.245 71.07
## Life.expectancy 72.60 83.00 72.6 73.30 63.40 83.00 78.00 72.300 71.000 74.30
## CV residual     -4.56  5.02 -2.1  1.69  2.89  5.54  9.32  0.953 -0.245  3.23
##                   772   262   791  2917   983   599   1761  2060    573   2635
## Predicted       71.18 70.67 72.59 52.50 72.94 64.79 68.825 78.35 73.501 72.917
## cvpred          71.13 70.62 72.58 52.59 72.76 64.78 68.928 78.29 74.004 73.135
## Life.expectancy 73.60 69.50 75.30 49.30 73.90 61.30 69.900 82.00 73.100 73.300
## CV residual      2.47 -1.12  2.72 -3.29  1.14 -3.48  0.972  3.71 -0.904  0.165
##                  2255  1035  2659  1897    356 1238  2911  1557   2926  1382
## Predicted       62.55 81.12 70.66 49.46 74.311 69.0 61.44 67.46 56.128 72.32
## cvpred          62.62 80.69 70.76 48.96 74.072 69.1 61.56 67.35 56.098 72.17
## Life.expectancy 64.30 79.40 69.60 52.70 74.500 76.0 58.20 64.70 56.600 65.70
## CV residual      1.68 -1.29 -1.16  3.74  0.428  6.9 -3.36 -2.65  0.502 -6.47
##                  515  1821   2439   199  1006  1214    571    689 1567   950
## Predicted       53.4 65.67 78.628 65.27 81.22 67.28 72.416 77.240 61.9 64.85
## cvpred          53.6 65.46 78.675 65.13 81.26 67.79 73.208 77.253 62.2 64.83
## Life.expectancy 49.9 67.00 79.500 69.50 79.10 65.30 73.900 78.100 59.9 63.50
## CV residual     -3.7  1.54  0.825  4.37 -2.16 -2.49  0.692  0.847 -2.3 -1.33
## 
## Sum of squares = 2875    Mean square = 12.4    n = 231 
## 
## fold 3 
## Observations in test set: 231 
##                  1980   259  1078 2256  1528   397   491   1675   295  1623
## Predicted       64.17 73.40 59.90 62.2 75.60 73.77 60.52 72.185 60.91 58.86
## cvpred          64.32 73.14 59.95 62.3 75.41 73.74 60.13 72.046 60.86 58.83
## Life.expectancy 62.00 69.80 58.40 63.5 72.40 72.00 52.80 72.700 67.40 56.80
## CV residual     -2.32 -3.34 -1.55  1.2 -3.01 -1.74 -7.33  0.654  6.54 -2.03
##                   202  588  2507   2671   136   455  1492  1656   1112  2732
## Predicted       64.62 70.8 79.80 76.059 80.17 70.19 60.05 62.21 66.686 72.47
## cvpred          63.86 70.8 79.49 75.732 80.35 70.06 60.24 62.31 66.684 71.96
## Life.expectancy 68.20 72.8 82.30 74.800 84.00 72.40 58.10 62.20 65.900 78.00
## CV residual      4.34  2.0  2.81 -0.932  3.65  2.34 -2.14 -0.11 -0.784  6.04
##                  1588    25  1079  2711   900   2137   952    407     42   942
## Predicted       72.95 73.33 63.54 62.11 76.40 73.686 63.68 56.968 72.805 78.86
## cvpred          72.91 73.11 63.27 62.26 76.12 73.835 63.78 57.111 72.901 78.99
## Life.expectancy 74.80 75.90 58.10 63.30 69.70 73.000 62.30 56.900 73.400 82.00
## CV residual      1.89  2.79 -5.17  1.04 -6.42 -0.835 -1.48 -0.211  0.499  3.01
##                   143    500  1579  2672   111  1194    408  1205   1736  2139
## Predicted       77.44 81.902 49.71 76.35 71.32 59.85 56.350 70.97 76.628 72.44
## cvpred          77.44 82.061 49.91 76.05 71.32 58.14 56.417 70.86 76.298 72.58
## Life.expectancy 78.60 81.600 48.50 74.70 72.60 65.50 56.100 68.70 75.600 69.60
## CV residual      1.16 -0.461 -1.41 -1.35  1.28  7.36 -0.317 -2.16 -0.698 -2.98
##                   459   240  1294  2436   1081   948    52  2583   426  1594
## Predicted       68.66 71.29 80.92 77.00 57.898 66.70 59.66 68.39 56.01 72.34
## cvpred          68.53 71.42 80.93 76.68 57.829 66.79 59.75 68.32 56.11 72.31
## Life.expectancy 71.80 68.00 89.00 81.00 57.300 65.50 56.00 71.40 54.10 73.80
## CV residual      3.27 -3.42  8.07  4.32 -0.529 -1.29 -3.75  3.08 -2.01  1.49
##                  1606  1310   1676   934  1869  1607  1467    144  2209  1309
## Predicted       72.28 69.75 72.329 78.04 69.67 71.47 72.72 77.208 69.85 71.14
## cvpred          71.93 69.78 72.242 77.69 69.63 71.16 72.51 77.183 69.61 71.09
## Life.expectancy 77.60 73.30 72.900 81.50 72.50 77.30 74.40 78.100 72.20 73.50
## CV residual      5.67  3.52  0.658  3.81  2.87  6.14  1.89  0.917  2.59  2.41
##                  2648  1822  1252    121 2661   2685  2377  1192   871   1069
## Predicted       73.91 65.47 81.08 82.471 73.2 74.800 64.17 63.86 78.19 69.996
## cvpred          73.89 65.36 80.79 82.126 72.9 74.718 64.38 62.53 78.12 69.798
## Life.expectancy 71.80 66.60 81.20 81.300 69.4 74.800 65.80 66.40 76.10 69.200
## CV residual     -2.09  1.24  0.41 -0.826 -3.5  0.082  1.42  3.87 -2.02 -0.598
##                  1362    406  1732  1036  2844   941   1601  2478  1988  2501
## Predicted       69.76 57.070 66.30 78.37 68.66 79.00 71.951 71.07 61.48 43.90
## cvpred          69.92 56.922 66.49 78.03 68.61 79.18 71.889 71.07 61.69 43.54
## Life.expectancy 63.90 57.500 62.80 79.70 71.70 81.00 72.700 76.00 59.60 45.60
## CV residual     -6.02  0.578 -3.69  1.67  3.09  1.82  0.811  4.93 -2.09  2.06
##                   131   2274   594  1065   270   233   1948  2011   1335   2400
## Predicted       78.06 72.849 68.69 68.33 70.56 71.97 66.054 73.03 74.067 56.516
## cvpred          77.74 72.845 68.37 68.35 70.59 71.75 65.838 72.95 73.906 56.624
## Life.expectancy 81.10 73.800 63.20 76.00 68.50 69.80 65.100 74.90 73.600 56.500
## CV residual      3.36  0.955 -5.17  7.65 -2.09 -1.95 -0.738  1.95 -0.306 -0.124
##                   797  1755   552  1624   342   102  1787   1236    21   2643
## Predicted       72.29 70.15 76.40 58.14 64.53 71.85 61.27 67.795 73.68 73.008
## cvpred          72.19 70.13 76.17 58.08 64.66 71.81 61.08 67.799 73.54 72.779
## Life.expectancy 74.20 72.30 79.60 56.50 61.10 73.50 65.20 67.900 76.60 72.400
## CV residual      2.01  2.17  3.43 -1.58 -3.56  1.69  4.12  0.101  3.06 -0.379
##                   566  2374    88   2219   585  1340    451     30  1625   269
## Predicted       73.85 63.79 77.43 67.011 71.68 75.21 73.222 72.934 57.92 72.92
## cvpred          73.56 63.83 77.33 66.843 71.65 75.03 72.922 72.747 57.87 72.72
## Life.expectancy 75.00 66.80 75.40 67.300 73.50 72.80 72.800 73.300 56.00 68.40
## CV residual      1.44  2.97 -1.93  0.457  1.85 -2.23 -0.122  0.553 -1.87 -4.32
##                   676  2646   576  2728  2561   998  1144  1879   93  1874
## Predicted       76.43 72.49 70.49 52.67 68.48 77.40 69.97 56.55 77.1 68.87
## cvpred          76.28 72.39 70.15 52.79 68.44 77.15 69.87 56.54 76.9 68.86
## Life.expectancy 81.00 72.00 71.70 48.80 66.40 86.00 73.60 61.40 74.1 76.00
## CV residual      4.72 -0.39  1.55 -3.99 -2.04  8.85  3.73  4.86 -2.8  7.14
##                  1899  2251   831  2068  1360  2261  2566   114  1789   858
## Predicted       48.52 63.98 73.46 79.83 70.44 60.42 67.87 88.71 62.88 58.06
## cvpred          47.99 63.95 73.21 79.55 70.57 60.53 67.91 88.52 62.97 58.36
## Life.expectancy 52.00 66.40 69.90 77.30 64.70 59.70 65.20 82.70 64.50 67.00
## CV residual      4.01  2.45 -3.31 -2.25 -5.87 -0.83 -2.71 -5.82  1.53  8.64
##                 1240    386   603   452   628    148 1968    648  1447    86
## Predicted       69.2 74.944 63.87 71.12 74.57 72.020 72.7 76.230 75.76 76.97
## cvpred          69.2 74.878 63.93 70.94 74.32 72.019 72.5 75.897 75.69 76.75
## Life.expectancy 76.0 74.300 60.00 72.70 79.40 71.900 76.4 76.300 73.60 75.50
## CV residual      6.8 -0.578 -3.93  1.76  5.08 -0.119  3.9  0.403 -2.09 -1.25
##                   107  1209   124  1380 1548  1945    775  2828   2030    98
## Predicted       68.91 69.69 82.60 72.10 83.4 65.12 73.781 70.61 68.670 73.78
## cvpred          68.85 69.65 82.07 72.03 83.7 64.42 73.635 70.57 68.904 73.58
## Life.expectancy 73.00 67.90 86.00 66.10 79.4 66.00 73.100 69.20 68.000 74.60
## CV residual      4.15 -1.75  3.93 -5.93 -4.3  1.58 -0.535 -1.37 -0.904  1.02
##                  758   399     44  951  1024   100  2562  1562   2226  2301
## Predicted       59.9 75.96 73.459 64.2 63.36 72.33 68.55 63.41 66.079  60.7
## cvpred          60.0 75.77 73.276 64.2 63.06 72.28 68.52 63.44 66.045  60.8
## Life.expectancy 61.8 71.60 72.300 62.8 57.60 74.40 66.10 62.30 65.100  49.7
## CV residual      1.8 -4.17 -0.976 -1.4 -5.46  2.12 -2.42 -1.14 -0.945 -11.1
##                   506   1792  1533  2564   418  2449  1660   1291  2292  1831
## Predicted       79.14 62.617 76.12 68.18 63.13 71.24 62.16 81.863 69.35 82.59
## cvpred          78.89 62.729 76.15 68.15 63.12 71.08 62.24 81.844 69.25 83.02
## Life.expectancy 85.00 63.500 78.00 65.50 59.10 72.30 61.20 81.300 72.20 81.70
## CV residual      6.11  0.771  1.85 -2.65 -4.02  1.22 -1.04 -0.544  2.95 -1.32
##                  1604   2018   600  1725  1241  1867   756    402 2553  2121
## Predicted       73.65 71.963 64.29 73.83 69.36 68.71 60.59 59.908 69.5 76.00
## cvpred          73.16 71.824 64.28 73.59 69.45 68.55 60.68 59.969 69.5 75.95
## Life.expectancy 78.20 72.800 61.00 65.90 74.00 73.20 62.70 59.300 72.6 74.80
## CV residual      5.04  0.976 -3.28 -7.69  4.55  4.65  2.02 -0.669  3.1 -1.15
##                  1529  2742   105   562  2500  1030   2448   2154  1791  1769
## Predicted       77.26 72.19 70.70 73.88 45.05 79.54 71.065 65.110 62.47 60.69
## cvpred          77.23 72.19 70.52 73.71 44.64 79.34 70.917 65.009 62.59 60.29
## Life.expectancy 72.20 67.40 73.50 75.80 46.00 84.00 71.800 65.200 63.90 54.30
## CV residual     -5.03 -4.79  2.98  2.09  1.36  4.66  0.883  0.191  1.31 -5.99
##                   503   798   326  1487   322 1589    1773  2305   339   1559
## Predicted       78.92 71.61 73.21 42.28 74.51 72.4 52.0174  56.4 67.79 64.233
## cvpred          78.62 71.33 72.79 42.53 74.23 72.3 52.1926  56.7 67.81 64.222
## Life.expectancy 81.00 74.40 76.40 45.50 77.20 74.6 52.1000  46.2 64.20 63.800
## CV residual      2.38  3.07  3.61  2.97  2.97  2.3 -0.0926 -10.5 -3.61 -0.422
##                  1470  2609   1010  1825  1790  579   2690  875 1278    644
## Predicted       67.88 67.59 78.389 62.54 65.63 72.3 73.043 75.2 78.4 76.831
## cvpred          67.41 67.53 78.382 62.34 65.48 72.2 72.987 75.2 78.1 76.732
## Life.expectancy 73.70 66.20 78.000 64.70 64.20 74.4 73.200 73.0 81.0 77.700
## CV residual      6.29 -1.33 -0.382  2.36 -1.28  2.2  0.213 -2.2  2.9  0.968
##                  1647  1540   785  1452    987   1483     32  1575   551   2576
## Predicted       78.11 82.37 69.56 76.47 74.036 45.985 73.033 56.87 76.41 73.301
## cvpred          78.04 82.83 69.48 76.51 73.724 46.393 72.835 56.91 76.17 73.088
## Life.expectancy 78.50 81.70 71.20 75.00 74.400 46.200 72.600 54.10 79.30 73.700
## CV residual      0.46 -1.13  1.72 -1.51  0.676 -0.193 -0.235 -2.81  3.13  0.612
##                 2705  1303   331   467  1394  2134  2009   505   423    646
## Predicted       61.2 71.82 66.13 66.42 61.72 72.13 73.39 81.57 59.20 77.910
## cvpred          61.4 71.73 65.75 66.26 61.72 72.25 73.28 81.36 59.31 77.722
## Life.expectancy 64.5 75.20 75.00 67.80 64.10 78.00 75.30 85.00 56.20 77.000
## CV residual      3.1  3.47  9.25  1.54  2.38  5.75  2.02  3.64 -3.11 -0.722
##                   2681
## Predicted       73.512
## cvpred          73.397
## Life.expectancy 72.900
## CV residual     -0.497
## 
## Sum of squares = 2623    Mean square = 11.4    n = 231 
## 
## fold 4 
## Observations in test set: 231 
##                    55    24  2908   469    643  1474   238  1082    34  2837
## Predicted       56.40 73.79 64.15 68.91 76.915 68.44 71.21 61.63 76.26 70.14
## cvpred          56.52 73.86 64.04 69.39 77.275 68.59 71.08 62.03 76.57 69.94
## Life.expectancy 49.10 75.30 61.10 67.00 77.800 72.70 67.20 56.80 75.40 67.30
## CV residual     -7.42  1.44 -2.94 -2.39  0.525  4.11 -3.88 -5.23 -1.17 -2.64
##                  2141  2369   109    16   1681  1693   638  1817  1014   488
## Predicted       71.52 66.23 70.85 57.66 70.945 73.50 75.09 66.14 65.88 57.11
## cvpred          71.59 66.13 70.72 57.79 70.894 73.33 75.25 66.95 65.81 56.94
## Life.expectancy 68.40 68.00 72.70 54.80 71.500 75.80 78.00 68.90 61.60 54.20
## CV residual     -3.19  1.87  1.98 -2.99  0.606  2.47  2.75  1.95 -4.21 -2.74
##                  1448 2202 2582   914   687  2055   554  1384 1784   855   944
## Predicted       79.03 72.6 68.9 68.96 76.04 76.40 76.63 72.43 66.9 58.34 79.47
## cvpred          79.43 72.7 68.9 68.76 76.21 76.54 76.56 72.24 67.2 58.28 79.07
## Life.expectancy 72.80 73.8 71.7 67.70 78.40 73.70 78.90 65.30 65.9 62.90 79.20
## CV residual     -6.63  1.1  2.8 -1.06  2.19 -2.84  2.34 -6.94 -1.3  4.62  0.13
##                   2042  1536   327   2477   945     2  1355  1654   1678   800
## Predicted       76.215 78.53 71.92 71.062 80.49 63.00 71.92 63.80 71.740 71.95
## cvpred          76.634 78.89 72.42 71.091 80.59 63.62 71.55 64.31 71.689 71.72
## Life.expectancy 77.100 71.40 76.10 71.300 79.00 59.90 65.30 62.70 72.100 73.60
## CV residual      0.466 -7.49  3.68  0.209 -1.59 -3.72 -6.25 -1.61  0.411  1.88
##                  2839    861  2835  2070  1881  2936   1991  1345  1882     956
## Predicted       69.99 58.620 70.12 78.89 56.53 48.42 60.106 74.57 55.61 61.5528
## cvpred          69.79 58.999 69.99 79.18 56.58 48.18 59.843 74.66 55.88 61.4307
## Life.expectancy 67.20 59.400 67.80 76.90 63.00 44.80 58.900 71.90 59.40 61.4000
## CV residual     -2.59  0.401 -2.19 -2.28  6.42 -3.38 -0.943 -2.76  3.52 -0.0307
##                  1595   152   773  1653   1950   122   627   2637  2260   590
## Predicted       72.14 71.43 71.46 65.28 64.599 86.15 74.58 74.037 60.45 71.00
## cvpred          72.12 71.28 71.35 65.52 65.248 86.29 74.76 73.888 60.63 70.92
## Life.expectancy 73.70 73.00 73.40 63.00 64.600 81.20 79.50 73.000 65.00 71.80
## CV residual      1.58  1.72  2.05 -2.52 -0.648 -5.09  4.74 -0.888  4.37  0.88
##                 1611  1339  1349  1121   1671  1612  1143 2912 2216  2623  1076
## Predicted       70.9 76.65 75.72 66.50 73.569 71.28 70.02 60.0 74.6 62.09 60.07
## cvpred          71.3 76.85 75.75 66.67 73.522 71.73 70.13 60.1 74.5 62.05 60.28
## Life.expectancy 75.4 73.00 69.50 65.40 73.900 75.00 73.90 58.0 72.0 57.40 58.10
## CV residual      4.1 -3.85 -6.25 -1.27  0.378  3.27  3.77 -2.1 -2.5 -4.65 -2.18
##                   106  2162  2035   517  1149   1068   1482 2847  1800   2375
## Predicted       70.80 62.28 68.84 52.80 69.02 69.875 47.765 68.6 66.73 67.218
## cvpred          70.65 62.62 68.96 52.72 69.01 70.282 47.349 68.5 66.92 67.378
## Life.expectancy 72.90 55.30 67.30 49.80 72.50 69.700 47.800 71.2 65.80 66.500
## CV residual      2.25 -7.32 -1.66 -2.92  3.49 -0.582  0.451  2.7 -1.12 -0.878
##                   2019  2740     3   1578  1883   2409  1969  2838  2302   1955
## Predicted       72.031 71.84 63.05 50.507 54.33 56.154 73.38 70.18  59.7 62.453
## cvpred          71.883 71.89 63.69 49.866 54.39 56.431 73.34 69.99  60.0 62.646
## Life.expectancy 72.200 67.70 59.90 50.000 58.20 57.300 76.20 67.80  48.9 63.500
## CV residual      0.317 -4.19 -3.79  0.134  3.81  0.869  2.86 -2.19 -11.1  0.854
##                  2647    251  1457 2704  2608   1376    1778    1949  2482 1655
## Predicted       73.94 79.246 74.57 61.4 68.12 52.168 50.1567 65.0208 72.69 63.4
## cvpred          73.71 79.408 74.62 61.4 68.17 51.785 49.8724 64.7901 72.82 63.9
## Life.expectancy 71.90 78.900 69.90 65.6 66.60 52.100 49.8000 64.8000 69.50 62.5
## CV residual     -1.81 -0.508 -4.72  4.2 -1.57  0.315 -0.0724  0.0099 -3.32 -1.4
##                     354   910  1680  1863   1466  1273  205  937    405    649
## Predicted       74.6335 72.21 71.32 70.38 74.103 78.99 64.1 80.8 57.450 76.675
## cvpred          74.7762 71.93 71.24 70.52 74.348 78.99 63.9 80.8 57.825 76.932
## Life.expectancy 74.8000 68.10 71.50 74.50 74.500 81.50 66.8 81.1 58.100 76.000
## CV residual      0.0238 -3.83  0.26  3.98  0.152  2.51  2.9  0.3  0.275 -0.932
##                  2913   275  2041   1375  2215   936  1697   586  1391  1757
## Predicted       59.48 63.27 79.13 52.124 71.78 76.11 72.77 71.12 61.47 68.03
## cvpred          59.21 63.34 79.58 51.782 71.55 76.33 72.57 71.08 61.84 68.11
## Life.expectancy 57.40 59.50 77.30 52.400 75.00 81.30 75.00 73.10 64.70 71.40
## CV residual     -1.81 -3.84 -2.28  0.618  3.45  4.97  2.43  2.02  2.86  3.29
##                  1446  2049   630  2300 2551    574 2503  1206  1271   790
## Predicted       76.41 76.03 75.00  66.5 69.9 73.363 36.4 70.83 80.20 72.56
## cvpred          76.53 76.28 75.12  67.1 69.8 73.295 35.5 70.84 80.09 72.58
## Life.expectancy 73.80 75.20 79.00  54.0 72.8 72.700 46.4 68.50 81.80 75.50
## CV residual     -2.73 -1.08  3.88 -13.1  3.0 -0.595 10.9 -2.34  1.71  2.92
##                   2437  2745 2552 1983 2723    17  1776      149   254   997
## Predicted       80.122 71.78 69.8 67.0 61.0 74.64 50.11 71.68221 82.12 80.03
## cvpred          80.377 71.58 69.8 67.1 61.8 74.66 49.77 71.60361 82.31 80.55
## Life.expectancy 81.000 67.70 72.7 61.4 55.5 77.80 54.00 71.60000 78.00 86.00
## CV residual      0.623 -3.88  2.9 -5.7 -6.3  3.14  4.23 -0.00361 -4.31  5.45
##                   1333    258   1944   828   2440  1751    1657  1007   2557
## Predicted       73.966 69.428 65.540 69.99 79.797 71.81 61.8170 80.26 69.137
## cvpred          74.036 69.396 65.957 69.83 79.928 71.99 61.9308 80.32 69.134
## Life.expectancy 73.900 70.000 66.200 75.00 79.400 73.90 62.0000 78.50 68.800
## CV residual     -0.136  0.604  0.243  5.17 -0.528  1.91  0.0692 -1.82 -0.334
##                  1218   2819  2493  2397  2674  1016  2567    11    575  2363
## Predicted       68.59 75.694 58.47 68.55 76.18 64.50 67.55 60.67 72.880 66.35
## cvpred          68.44 75.755 58.24 69.02 76.34 64.44 67.36 61.31 72.998 66.28
## Life.expectancy 66.30 75.400 56.50 59.20 74.60 69.00 64.30 57.30 72.200 68.80
## CV residual     -2.14 -0.355 -1.74 -9.82 -1.74  4.56 -3.06 -4.01 -0.798  2.52
##                   784  1687 1023  1672   2824  1300   404  2268   1282  1060
## Predicted       69.66 73.13 62.5 73.05 75.613 71.86 56.66 73.21 78.582 67.83
## cvpred          69.59 73.06 62.9 73.05 75.574 71.79 57.13 72.96 78.471 67.85
## Life.expectancy 71.40 76.30 57.9 73.60 75.400 75.80 58.60 75.30 78.900 71.70
## CV residual      1.81  3.24 -5.0  0.55 -0.174  4.01  1.47  2.34  0.429  3.85
##                  2223   365   486  1386  2584   888   2161   639   343  2854
## Predicted       68.97 75.12 63.67 73.31 68.70 58.12 58.379 73.21 62.67 62.95
## cvpred          69.22 75.22 63.94 73.75 68.74 57.98 58.046 73.24 62.45 63.08
## Life.expectancy 66.20 71.80 55.30 65.10 71.20 61.80 57.600 78.30 59.20 69.60
## CV residual     -3.02 -3.42 -8.64 -8.65  2.46  3.82 -0.446  5.06 -3.25  6.52
##                   2290  1353   2048  2069  1381  1153   328  2016  2159  1196
## Predicted       71.429 72.85 75.935 80.16 72.28 67.99 73.39 71.35 62.10 65.38
## cvpred          71.289 72.56 76.155 80.52 72.11 67.89 73.56 71.18 62.19 67.17
## Life.expectancy 72.200 67.80 75.300 77.20 65.80 71.30 76.00 74.00 68.00 64.80
## CV residual      0.911 -4.76 -0.855 -3.32 -6.31  3.41  2.44  2.82  5.81 -2.37
##                  1694  2142  1574   645     6  2818  1558  156  1198  2267
## Predicted       73.69 71.92  64.8 77.99 62.38 74.47 62.99 70.9 64.47 72.84
## cvpred          73.56 72.02  65.3 78.43 63.03 74.51 63.05 70.9 65.82 72.65
## Life.expectancy 75.30 68.20  55.3 77.10 58.80 76.40 64.30 68.4 64.00 75.40
## CV residual      1.74 -3.82 -10.0 -1.33 -4.23  1.89  1.25 -2.5 -1.82  2.75
##                   1762    330  1346  1995  2938   685  2813 1779  2622 1152
## Predicted       70.178 74.819 74.30 70.22 38.11 76.98 76.12 55.8 67.44 67.2
## cvpred          70.385 75.002 74.38 69.99 37.44 77.19 76.24 55.9 67.75 67.1
## Life.expectancy 69.500 75.700 71.70 73.60 46.00 78.60 76.80 49.5 58.30 71.6
## CV residual     -0.885  0.698 -2.68  3.61  8.56  1.41  0.56 -6.4 -9.45  4.5
##                   2028  939    84  2032  2548   1987   580  1147  1699  1388
## Predicted       68.359 77.0 79.24 68.53 68.78 60.967 72.97 71.43 72.59 70.05
## cvpred          68.544 76.7 79.25 68.63 68.89 60.867 72.99 71.63 72.36 69.66
## Life.expectancy 68.000 89.0 75.90 67.50 73.50 59.900 74.30 73.00 74.80 65.00
## CV residual     -0.544 12.3 -3.35 -1.13  4.61 -0.967  1.31  1.37  2.44 -4.66
##                  2845  2724  2703   2816  1477   635   428  1734  2935    56
## Predicted       68.52 61.43 61.72 76.914 57.42 75.11 53.75 77.56 38.97 57.06
## cvpred          68.47 62.04 61.72 76.941 57.62 75.23 53.84 77.63 38.47 57.04
## Life.expectancy 71.60 54.90 65.80 76.300 52.10 78.00 52.60 75.90 44.50 48.70
## CV residual      3.13 -7.14  4.08 -0.641 -5.52  2.77 -1.24 -1.73  6.03 -8.34
## 
## Sum of squares = 3313    Mean square = 14.3    n = 231 
## 
## fold 5 
## Observations in test set: 231 
##                  1999  2286  569   647 1572   1034  1691  1077   2270   346
## Predicted       70.33 71.27 73.2 75.30 60.8 79.626 73.19 60.36 73.620 57.74
## cvpred          70.36 71.43 72.9 75.23 60.7 79.768 73.16 60.31 73.643 57.66
## Life.expectancy 72.70 72.60 74.4 76.60 57.6 79.900 75.60 58.80 74.600 54.80
## CV residual      2.34  1.17  1.5  1.37 -3.1  0.132  2.44 -1.51  0.957 -2.86
##                   1598   400    41   905  2431   116   125  1494    90   591
## Predicted       72.560 73.83 71.48 75.80 79.44 88.18 84.04 60.53 76.92 69.69
## cvpred          72.478 73.71 71.44 75.97 79.22 88.52 84.17 60.43 77.08 69.42
## Life.expectancy 73.200 71.10 73.80 68.90 81.90 82.30 83.00 67.00 75.20 71.50
## CV residual      0.722 -2.61  2.36 -7.07  2.68 -6.22 -1.17  6.57 -1.88  2.08
##                  1994   827  1343   1253  2153  2833  1621   2604  1341  2444
## Predicted       69.55 72.65 74.83 81.150 68.29 69.21 58.92 68.581 75.09 71.79
## cvpred          69.73 72.84 74.72 81.033 68.48 69.23 58.89 68.624 74.97 71.73
## Life.expectancy 73.80 71.20 72.30 81.000 65.70 68.00 57.30 67.700 72.40 74.60
## CV residual      4.07 -1.64 -2.42 -0.033 -2.78 -1.23 -1.59 -0.924 -2.57  2.87
##                  1387  2126  1040  1368  2547  1758   255  1256  1990   2683
## Predicted       71.25 75.51 76.84 60.53 69.08 69.48 84.46 83.28 60.61 76.444
## cvpred          71.09 75.38 76.86 60.35 68.82 69.52 84.48 83.21 60.42 76.438
## Life.expectancy 65.00 73.10 79.00 63.00 73.70 71.00 78.00 86.00 59.10 75.500
## CV residual     -6.09 -2.28  2.14  2.65  4.88  1.48 -6.48  2.79 -1.32 -0.938
##                   2502  2605 2071 1304   2693   1334   799  1038   246   249
## Predicted       44.807 68.70 77.9 70.8 72.387 73.722 72.22 77.56 77.90 77.33
## cvpred          45.103 68.75 77.9 70.8 72.308 73.565 72.23 77.56 77.89 77.15
## Life.expectancy 45.900 67.40 76.6 75.0 72.000 73.700 74.40 79.20 80.00 79.50
## CV residual      0.797 -1.35 -1.3  4.2 -0.308  0.135  2.17  1.64  2.11  2.35
##                   420   284   1039   1119  1580  2125  2505  2653  1971     38
## Predicted       62.56 60.18 78.120 65.701 48.58 76.55 39.10 71.69 73.63 73.970
## cvpred          62.64 60.23 78.255 65.448 48.55 76.43 39.08 71.62 73.62 73.935
## Life.expectancy 58.00 56.10 79.100 65.300 47.10 73.40 48.40 78.00 75.80 74.700
## CV residual     -4.64 -4.13  0.845 -0.148 -1.45 -3.03  9.32  6.38  2.18  0.765
##                 1458 1276  2138   304   532   2003  1824   1764  2744   419
## Predicted       74.2 78.7 73.48 57.72 54.16 70.844 67.38 69.517 72.21 67.06
## cvpred          74.0 78.6 73.47 58.23 53.92 70.903 67.43 69.586 72.18 67.35
## Life.expectancy 71.0 84.0 70.00 62.00 51.80 71.900 65.40 68.600 67.60 58.60
## CV residual     -3.0  5.4 -3.47  3.77 -2.12  0.997 -2.03 -0.986 -4.58 -8.75
##                   274  1636   2924   2046  2054  1767  1111   2925    348  2722
## Predicted       63.66 77.73 59.432 76.734 76.73 62.97 66.79 58.255 49.196 61.92
## cvpred          63.72 77.36 59.489 76.606 76.58 63.25 66.81 58.339 49.091 62.32
## Life.expectancy 59.70 81.40 59.200 75.700 74.20 55.30 65.60 58.000 48.100 56.30
## CV residual     -4.02  4.04 -0.289 -0.906 -2.38 -7.95 -1.21 -0.339 -0.991 -6.02
##                  1537  1269   338   519  1600  2696  2130  1306   2814  982
## Predicted       77.84 80.45 68.54 52.12 73.93 73.54 74.29 71.94 75.914 74.7
## cvpred          77.85 80.44 68.37 51.97 73.94 73.41 74.09 71.92 75.908 74.7
## Life.expectancy 71.20 82.10 65.10 48.60 72.90 78.00 71.90 74.50 76.500 74.2
## CV residual     -6.65  1.66 -3.27 -3.37 -1.04  4.59 -2.19  2.58  0.592 -0.5
##                  1211  1771   2651   198    358  2738  1730   410 2157 1880
## Predicted       71.22 60.11 71.764 65.77 74.123 70.39 67.79 59.48 66.2 56.8
## cvpred          71.11 60.52 71.688 65.85 74.081 70.18 67.76 59.72 66.6 56.8
## Life.expectancy 67.50 53.80 71.100 69.90 73.800 67.70 63.80 54.30 62.8 69.0
## CV residual     -3.61 -6.72 -0.588  4.05 -0.281 -2.48 -3.96 -5.42 -3.8 12.2
##                   141   1268  403  1964  1019  1301   679  2140  1722  2848
## Predicted       76.39 81.295 62.8 72.67 66.50 71.68 77.21 72.02 74.50 68.72
## cvpred          76.38 81.318 63.1 72.61 66.71 71.64 77.04 71.98 74.75 68.68
## Life.expectancy 78.80 82.200 59.0 77.30 59.90 75.60 79.50 69.40 66.30 71.00
## CV residual      2.42  0.882 -4.1  4.69 -6.81  3.96  2.46 -2.58 -8.45  2.32
##                   363  1197  2496    357 1641  2508   2020  1989   1453 1984
## Predicted       74.08 62.46 53.42 74.372 76.9 79.90 72.820 61.25 76.043 62.8
## cvpred          74.07 62.55 53.67 74.298 76.6 79.51 72.913 60.93 75.878 62.8
## Life.expectancy 72.70 64.40 52.60 74.100 82.0 81.90 72.100 59.30 76.000 61.1
## CV residual     -1.37  1.85 -1.07 -0.198  5.4  2.39 -0.813 -1.63  0.122 -1.7
##                 2574  1583   778   325  1550   1739  1461  2669  2735    104
## Predicted       71.5 46.75 70.51 73.47 82.12 75.182 73.72 76.36 73.99 72.204
## cvpred          71.6 46.78 70.57 73.42 82.43 75.194 73.53 76.43 73.86 72.323
## Life.expectancy 74.1 44.60 73.30 76.90 78.70 75.000 74.90 74.90 75.00 73.200
## CV residual      2.5 -2.18  2.73  3.48 -3.73 -0.194  1.37 -1.53  1.14  0.877
##                    10  1374  2452  2581   2285  1450   2721  1293   859   794
## Predicted       60.68 53.42 71.71 69.56 72.490 76.44 57.450 81.29 57.85 72.59
## cvpred          60.56 53.42 71.69 69.66 72.318 76.25 57.622 81.21 57.83 72.63
## Life.expectancy 57.30 53.00 74.20 71.60 72.700 71.90 57.500 88.00 62.00 74.60
## CV residual     -3.26 -0.42  2.51  1.94  0.382 -4.35 -0.122  6.79  4.17  1.97
##                   142   227   890  2062   1008  1688  2368   1332  473   2026
## Predicted       80.58 76.51 55.98 78.06 78.564 71.97 66.66 73.660 67.9 68.335
## cvpred          80.84 76.85 56.19 78.23 78.528 72.03 66.68 73.521 68.1 68.222
## Life.expectancy 78.70 71.70 59.80 79.30 78.400 76.10 68.10 74.000 65.0 68.100
## CV residual     -2.14 -5.15  3.61  1.07 -0.128  4.07  1.42  0.479 -3.1 -0.122
##                  1003    135    91  103   514  2211  2454    874 1617  1444
## Predicted       82.13 81.282 77.01 70.2 54.09 73.68 71.80 74.933 70.2 76.23
## cvpred          82.42 81.295 77.13 70.2 53.93 73.71 71.75 75.156 70.3 75.89
## Life.expectancy 79.80 82.000 74.90 73.3 58.00 71.60 73.90 74.200 78.0 74.40
## CV residual     -2.62  0.705 -2.23  3.1  4.07 -2.11  2.15 -0.956  7.7 -1.49
##                   456  1637 1020    368   323  1871  1547  2135  1061   2483
## Predicted       70.08 77.20 61.7 74.795 75.51 71.46 76.41 72.02 68.32 69.745
## cvpred          70.28 76.92 61.7 74.884 75.51 71.63 76.18 71.91 68.26 69.672
## Life.expectancy 72.40 81.10 59.4 75.000 77.00 73.00 79.70 77.00 71.40 69.300
## CV residual      2.12  4.18 -2.3  0.116  1.49  1.37  3.52  5.09  3.14 -0.372
##                  2559   1834   873   261  2673   157   2277  760  2229   291
## Predicted       69.08 80.249 76.00 70.37 76.01 70.58 73.405 59.1 65.86 67.78
## cvpred          69.04 80.155 76.22 70.41 76.14 70.39 73.431 58.9 65.84 67.78
## Life.expectancy 67.30 81.100 74.90 69.40 74.70 67.80 73.000 69.0 63.80 69.10
## CV residual     -1.74  0.945 -1.32 -1.01 -1.44 -2.59 -0.431 10.1 -2.04  1.32
##                  2398   2642 1685    993   876  2680  1613  2826  1729  1371
## Predicted       62.12 72.856 73.0 72.424 74.80 75.29 71.66 73.56 67.10 57.99
## cvpred          61.91 72.938 73.0 72.355 75.02 75.47 71.64 73.35 67.05 58.05
## Life.expectancy 58.90 72.500 76.6 73.000 73.00 73.20 74.30 75.10 64.00 56.80
## CV residual     -3.01 -0.438  3.6  0.645 -2.02 -2.27  2.66  1.75 -3.05 -1.25
##                  1866  2858 2057 2404  2701   280  1190  1359  2306   2815
## Predicted       68.84 64.71 77.0 50.8 71.32 61.63 72.34 70.70  61.8 76.221
## cvpred          68.93 65.61 76.8 50.8 71.46 61.68 73.17 70.76  62.2 76.197
## Life.expectancy 74.50 69.00 89.0 53.8 65.60 57.60 67.30 64.40  45.3 77.000
## CV residual      5.57  3.39 12.2  3.0 -5.86 -4.08 -5.87 -6.36 -16.9  0.803
##                  2655   57    393  1451    26   530  2146  2914  1116    1801
## Predicted       70.24 56.7 72.605 75.84 70.42 55.09 70.84 62.59 71.13 64.4394
## cvpred          69.83 56.8 72.493 75.68 70.49 54.93 70.81 62.96 71.41 64.3662
## Life.expectancy 74.00 48.2 72.600 78.00 74.20 52.60 65.00 55.70 65.20 64.3000
## CV residual      4.17 -8.6  0.107  2.32  3.71 -2.33 -5.81 -7.26 -6.21 -0.0662
##                  1460   290  1986   1296  1037    82  1875   629  2649  1596
## Predicted       73.69 67.87 66.16 79.838 77.14 77.39 68.58 74.71 74.29 72.47
## cvpred          73.48 67.87 66.28 79.709 77.31 77.51 68.64 74.75 74.37 72.39
## Life.expectancy 74.80 69.40 64.00 80.000 79.30 76.20 75.00 79.20 71.60 73.60
## CV residual      1.32  1.53 -2.28  0.291  1.99 -1.31  6.36  4.45 -2.77  1.21
##                  1365  1383    19  1498  1661 1750    1645  1568 2376   2667
## Predicted       63.45 72.47 74.59 62.48 61.79 71.8 79.2409 61.94 63.8 74.650
## cvpred          63.48 72.75 74.66 62.47 61.74 71.8 79.0703 61.82 63.8 74.741
## Life.expectancy 62.60 65.50 77.20 58.60 69.00 74.1 79.0000 59.30 66.2 75.100
## CV residual     -0.88 -7.25  2.54 -3.87  7.26  2.3 -0.0703 -2.52  2.4  0.359
##                  2129
## Predicted       74.56
## cvpred          74.41
## Life.expectancy 72.50
## CV residual     -1.91
## 
## Sum of squares = 3243    Mean square = 14    n = 231 
## 
## Overall (Sum over all 231 folds) 
##   ms 
## 12.6
mean((data.test$Life.expectancy - predict(model.additive, data.test)) ^ 2)
## [1] 13.5
model.selected = step(lm(Life.expectancy ~ ., data.train), trace = FALSE)
cv.lm(data.train, model.selected, m = 5, plotit = FALSE)
## Analysis of Variance Table
## 
## Response: Life.expectancy
##                                   Df Sum Sq Mean Sq F value  Pr(>F)    
## Year                               1    417     417   33.72 8.2e-09 ***
## Status                             1  17517   17517 1415.45 < 2e-16 ***
## Adult.Mortality                    1  28083   28083 2269.20 < 2e-16 ***
## infant.deaths                      1   1105    1105   89.29 < 2e-16 ***
## Alcohol                            1   2219    2219  179.28 < 2e-16 ***
## percentage.expenditure             1   1108    1108   89.55 < 2e-16 ***
## BMI                                1   3790    3790  306.21 < 2e-16 ***
## under.five.deaths                  1   2965    2965  239.62 < 2e-16 ***
## Total.expenditure                  1     32      32    2.55    0.11    
## Diphtheria                         1   1215    1215   98.16 < 2e-16 ***
## HIV.AIDS                           1   6689    6689  540.49 < 2e-16 ***
## Income.composition.of.resources    1   4907    4907  396.52 < 2e-16 ***
## Schooling                          1   2122    2122  171.49 < 2e-16 ***
## Residuals                       1140  14108      12                    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## fold 1 
## Observations in test set: 230 
##                   2275  2699 2124   834   2276 2697   884  1289 2160  1354
## Predicted       73.716 68.36 76.0 70.22 73.499 71.3 60.54 80.33 61.1 72.42
## cvpred          73.905 68.36 75.9 70.31 73.666 71.4 60.46 80.21 61.0 72.45
## Life.expectancy 73.600 66.00 74.3 69.00 73.000 74.0 64.20 81.60 59.6 66.60
## CV residual     -0.305 -2.36 -1.6 -1.31 -0.666  2.6  3.74  1.39 -1.4 -5.85
##                  1727  1140   1295  1590    508  1629  1366   2043  2258   688
## Predicted       69.11 68.22 80.310 72.56 79.375 60.52 63.39 76.428 63.79 75.49
## cvpred          69.14 68.25 80.257 72.64 79.538 60.48 63.31 76.335 63.68 75.38
## Life.expectancy 64.50 74.50 79.900 74.50 80.000 53.60 62.10 76.800 62.10 78.20
## CV residual     -4.64  6.25 -0.357  1.86  0.462 -6.88 -1.21  0.465 -1.58  2.82
##                  2709   2694  2855   1337  1348    824   283   392  1110  1721
## Predicted       60.43 72.094 62.42 73.442 75.82 71.281 59.06 74.30 70.30 72.37
## cvpred          59.95 72.215 62.07 73.563 75.94 71.386 58.99 74.18 70.39 72.41
## Life.expectancy 63.50 71.600 69.40 73.300 69.90 72.000 56.50 72.90 65.80 67.30
## CV residual      3.55 -0.615  7.33 -0.263 -6.04  0.614 -2.49 -1.28 -4.59 -5.11
##                   277  1979   299    92 1826  1002  1193   779   2206  2064
## Predicted       62.77 64.10 59.69 79.12 67.8 83.54 69.18 68.98 72.137 77.29
## cvpred          62.69 64.08 59.28 79.27 67.7 83.34 69.31 68.95 72.304 77.23
## Life.expectancy 59.10 62.20 65.00 74.70 64.3 79.90 66.00 72.90 72.600 78.70
## CV residual     -3.59 -1.88  5.72 -4.57 -3.4 -3.44 -3.31  3.95  0.296  1.47
##                  1493  2257   118   265    361  1963 1772   388  2852   634
## Predicted       63.36 61.05 86.66 70.88 73.740 74.14 58.8 75.08 68.27 73.71
## cvpred          63.35 60.92 86.64 70.93 73.867 74.35 58.8 74.98 68.29 73.91
## Life.expectancy 61.10 62.80 81.90 69.60 73.300 77.20 53.2 73.90 71.00 78.90
## CV residual     -2.25  1.88 -4.74 -1.33 -0.567  2.85 -5.6 -1.08  2.71  4.99
##                   1674   2928  2572   602  1682   300   203    474     826
## Predicted       71.820 52.009 71.84 64.26 70.73 58.99 64.80 63.280 71.7159
## cvpred          71.803 51.975 71.85 64.14 70.71 58.57 64.69 63.242 71.7874
## Life.expectancy 72.800 52.400 74.50 63.00 71.50 64.20 67.80 64.100 71.7000
## CV residual      0.997  0.425  2.65 -1.14  0.79  5.63  3.11  0.858 -0.0874
##                  2144 1966  1288  1723 2817   796   204    83     230  2931
## Predicted       71.03 73.0 82.91 71.12 75.0 72.39 64.70 77.41 72.9935 54.58
## cvpred          71.11 73.2 82.92 71.16 75.1 72.48 64.58 77.54 73.0819 54.67
## Life.expectancy 67.30 76.8 81.80 66.90 76.6 74.40 67.30 76.00 73.0000 46.60
## CV residual     -3.81  3.6 -1.12 -4.26  1.5  1.92  2.72 -1.54 -0.0819 -8.07
##                   2029   147  1022  1768  2725   427  2829 2002    293   547
## Predicted       67.796 70.30 62.80 62.00 55.42 54.92 70.52 70.8 67.603 77.53
## cvpred          67.793 70.34 62.85 61.98 55.43 54.84 70.61 70.9 67.539 77.75
## Life.expectancy 67.900 72.20 58.30 54.80 53.20 53.40 69.10 72.1 68.300 81.00
## CV residual      0.107  1.86 -4.55 -7.18 -2.23 -1.44 -1.51  1.2  0.761  3.25
##                   2228   1618   134  1967  1615  1997  2737 1970   1216     8
## Predicted       64.763 70.312 81.15 72.98 70.90 71.17 72.42 72.1 67.115 62.08
## cvpred          64.597 70.325 81.16 73.13 70.88 71.31 72.58 72.2 67.123 62.06
## Life.expectancy 64.300 69.600 84.00 76.50 72.70 73.20 69.20 75.8 66.700 58.10
## CV residual     -0.297 -0.725  2.84  3.37  1.82  1.89 -3.38  3.6 -0.423 -3.96
##                  1532  1336   421   1777   862   235   2033    394   1465  1150
## Predicted       75.91 74.60 61.43 50.119 53.56 72.16 67.729 72.581 74.172 68.49
## cvpred          75.76 74.81 61.33 50.081 53.13 72.25 67.658 72.338 74.388 68.57
## Life.expectancy 76.00 73.40 57.40 51.000 59.10 68.10 67.300 72.200 74.700 72.20
## CV residual      0.24 -1.41 -3.93  0.919  5.97 -4.15 -0.358 -0.138  0.312  3.63
##                 2692   2733   908  1191   133   279    592    18    272  2679
## Predicted       71.0 71.083 72.72 62.07 80.81 62.28 70.930 75.63 69.312 75.38
## cvpred          71.2 71.133 72.76 62.19 80.61 62.18 71.012 75.78 69.252 75.47
## Life.expectancy 72.4 71.000 68.50 66.80 88.00 58.40 71.400 77.50 68.300 73.50
## CV residual      1.2 -0.133 -4.26  4.61  7.39 -3.78  0.388  1.72 -0.952 -1.97
##                   886  462   909   864  1534  2291   681   1242    87  2585
## Predicted       59.55 68.9 72.68 51.33 79.04 70.28 76.32 69.056 77.37 68.57
## cvpred          59.49 68.9 72.72 51.02 78.91 70.22 76.25 69.132 77.54 68.51
## Life.expectancy 63.30 77.0 68.30 58.50 71.60 72.20 79.10 69.300 75.60 71.10
## CV residual      3.81  8.1 -4.42  7.48 -7.31  1.98  2.85  0.168 -1.94  2.59
##                   1952   833    567  1531   1541  2133   1125   126    872
## Predicted       64.432 70.35 74.014 79.57 81.763 72.35 63.345 83.66 76.237
## cvpred          64.386 70.44 74.058 79.45 81.566 72.14 63.391 83.64 76.375
## Life.expectancy 64.200 68.90 74.900 72.00 81.400 77.00 62.700 79.90 75.600
## CV residual     -0.186 -1.54  0.842 -7.45 -0.166  4.86 -0.691 -3.74 -0.775
##                  1544  2059    795  2658    359     1  2149       36  2910
## Predicted       77.50 78.10 74.320 70.77 73.952 63.58 70.30 74.95774 62.39
## cvpred          77.47 78.07 74.435 70.86 74.098 63.58 70.37 75.09319 62.35
## Life.expectancy 86.00 83.00 74.700 69.70 73.600 65.00 64.80 75.10000 59.20
## CV residual      8.53  4.93  0.265 -1.16 -0.498  1.42 -5.57  0.00681 -3.15
##                  1642  2850   2812  1832   2155  2577  1626   237  1627  1237
## Predicted       78.36 68.42 75.808 82.88 65.140 71.11 57.04 69.61 57.60 71.22
## cvpred          78.35 68.44 76.027 82.96 65.092 71.09 56.98 69.77 57.54 71.39
## Life.expectancy 80.00 75.00 76.800 81.40 64.600 73.50 55.50 67.70 55.00 69.50
## CV residual      1.65  6.56  0.773 -1.56 -0.492  2.41 -1.48 -2.07 -2.54 -1.89
##                   458  1393 1497    470  1189   2025    507  1207    14  1551
## Predicted       69.65 63.82 63.0 66.288 67.85 67.565 81.468 70.25 63.15 81.24
## cvpred          69.62 63.61 63.1 66.225 67.92 67.593 81.745 70.22 63.16 81.16
## Life.expectancy 72.10 64.30 59.2 66.600 67.60 68.400 81.000 68.30 56.20 78.60
## CV residual      2.48  0.69 -3.9  0.375 -0.32  0.807 -0.745 -1.92 -6.96 -2.56
##                  1895   536   266  2395   364 2638   2475    22  2619    350
## Predicted       51.66 52.15 70.66 65.01 76.60 75.9 71.026 72.71 64.84 45.121
## cvpred          51.76 52.04 70.69 65.06 76.72 76.1 71.144 72.83 64.74 45.281
## Life.expectancy 53.60 49.60 69.40 62.00 72.00 72.9 71.400 76.20 59.70 46.000
## CV residual      1.84 -2.44 -1.29 -3.06 -4.72 -3.2  0.256  3.37 -5.04  0.719
##                   367  2702 2856  1819 1616   550   301  244   2558   352   110
## Predicted       74.80 68.17 60.9 67.03 70.7 74.38 58.89 78.2 69.012 44.03 70.81
## cvpred          74.87 68.15 60.6 66.99 70.7 74.46 58.48 78.0 69.049 44.19 70.88
## Life.expectancy 71.00 65.60 69.3 68.00 71.8 79.10 63.30 83.0 68.100 47.80 72.60
## CV residual     -3.87 -2.55  8.7  1.01  1.1  4.64  4.82  5.0 -0.949  3.61  1.72
##                   138  2128  1565   2494  1631  1000  2640   2031     39   1287
## Predicted       76.41 74.89 63.08 55.530 55.25 83.18 74.21 68.318 73.482 82.900
## cvpred          76.21 74.72 62.99 55.567 55.17 83.21 74.33 68.302 73.586 82.903
## Life.expectancy 79.80 72.90 69.00 55.000 52.00 81.00 72.50 67.500 74.400 82.000
## CV residual      3.59 -1.82  6.01 -0.567 -3.17 -2.21 -1.83 -0.802  0.814 -0.903
##                   1833   597    137  1582   2652   2606   2832  1141  2165
## Predicted       80.174 65.32 81.069 46.99 71.119 68.303 68.964 72.02 53.76
## cvpred          80.121 65.25 80.857 47.01 71.245 68.185 68.927 72.17 53.59
## Life.expectancy 81.100 62.20 81.000 45.10 71.000 67.200 68.300 74.30 57.00
## CV residual      0.979 -3.05  0.143 -1.91 -0.245 -0.985 -0.627  2.13  3.41
##                   387   2401   2555   911    13 1274     37   472  2145   786
## Predicted       76.63 54.215 69.267 75.23 59.31 78.8 74.467 66.20 75.40 69.75
## cvpred          76.57 54.436 69.337 75.29 59.31 79.1 74.578 66.12 75.52 69.83
## Life.expectancy 74.10 55.300 69.600 68.00 56.70 81.0 74.900 65.60 66.40 72.00
## CV residual     -2.47  0.864  0.263 -7.29 -2.61  1.9  0.322 -0.52 -9.12  2.17
##                  2001  2657   2603   632   901  2402  1290  2367 1646   489
## Predicted       70.70 68.78 68.506 73.89 73.84 52.55 79.66 64.38 77.6 55.89
## cvpred          70.76 68.85 68.402 74.13 73.91 52.78 79.66 64.49 77.6 55.83
## Life.expectancy 72.30 69.90 68.000 79.20 69.60 54.50 81.50 68.30 78.7 53.60
## CV residual      1.54  1.05 -0.402  5.07 -4.31  1.72  1.84  3.81  1.1 -2.23
##                 2834   2289 2840   197   2013  1015   1018  1689   243  531
## Predicted       70.3 71.484 69.8 68.46 74.321 65.10 63.496 71.65 78.00 55.0
## cvpred          70.3 71.466 69.8 68.39 74.431 65.06 63.445 71.69 77.83 54.9
## Life.expectancy 67.9 72.200 67.1 73.00 73.700 61.20 63.000 75.60 87.00 52.2
## CV residual     -2.4  0.734 -2.7  4.61 -0.731 -3.86 -0.445  3.91  9.17 -2.7
##                    12   1614   2204
## Predicted       58.91 72.796 72.448
## cvpred          58.94 72.802 72.619
## Life.expectancy 57.00 73.400 73.200
## CV residual     -1.94  0.598  0.581
## 
## Sum of squares = 2527    Mean square = 11    n = 230 
## 
## fold 2 
## Observations in test set: 231 
##                   1108   2718  1609  2297  2933  2015  2405   2429   1677   605
## Predicted       66.535 59.935 71.49 63.96 41.67 70.86 51.22 81.864 72.232 57.77
## cvpred          66.467 59.878 71.45 62.72 41.89 70.98 51.32 81.689 72.328 57.13
## Life.expectancy 66.000 60.000 76.30 71.80 44.60 73.90 53.70 82.000 71.800 59.60
## CV residual     -0.467  0.122  4.85  9.08  2.71  2.92  2.38  0.311 -0.528  2.47
##                  2447   1740  1243    139     146  1696  1673  2736  2163  1718
## Predicted       72.10 74.880 67.74 79.130 72.3942 73.28 71.67 72.21 55.62 72.80
## cvpred          72.29 74.828 67.98 79.147 72.5289 73.28 71.87 72.11 55.43 72.88
## Life.expectancy 74.50 74.600 65.90 79.400 72.5000 75.00 73.30 69.80 53.40 68.40
## CV residual      2.21 -0.228 -2.08  0.253 -0.0289  1.72  1.43 -2.31 -2.03 -4.48
##                  2365  2434   466   242   1690    468   1281   777  1962  2707
## Predicted       66.45 79.03 66.95 80.77 75.138 66.686 78.445 70.98 71.75 61.15
## cvpred          66.31 79.02 66.96 80.66 75.037 66.694 78.572 70.94 71.79 60.13
## Life.expectancy 68.70 89.00 68.30 89.00 75.700 67.400 79.300 73.60 77.50 63.70
## CV residual      2.39  9.98  1.34  8.34  0.663  0.706  0.728  2.66  5.71  3.57
##                     43    583  1530  1358   461   1114   1462  1154   1904
## Predicted       71.890 74.242 76.78 70.61 68.85 66.487 74.114 67.69 50.934
## cvpred          72.044 74.077 76.74 70.76 68.79 66.496 74.155 67.64 49.717
## Life.expectancy 72.900 73.600 71.10 64.70 71.10 66.300 75.000 71.00 49.200
## CV residual      0.856 -0.477 -5.64 -6.06  2.31 -0.196  0.845  3.36 -0.517
##                  1094  1357  1903  1686   534  2222  1974  989  1756   1255
## Predicted       60.12 71.41 44.61 74.54 53.93 66.20 73.38 72.2 69.89 84.800
## cvpred          60.03 71.49 43.76 74.48 53.95 66.06 73.37 72.2 69.85 84.531
## Life.expectancy 57.60 64.60 49.80 76.60 51.20 66.60 75.50 73.9 71.80 84.000
## CV residual     -2.43 -6.89  6.04  2.12 -2.75  0.54  2.13  1.7  1.95 -0.531
##                  2061  1754   276   2296   345   1947 1239  1643   264  1280
## Predicted       78.13 71.91 61.48 71.200 59.53 65.542 69.4 78.24 71.06 77.46
## cvpred          78.08 71.78 61.52 71.314 59.69 65.826 69.5 78.25 71.02 77.69
## Life.expectancy 79.60 72.80 59.30 72.000 56.90 65.500 77.0 79.60 69.60 79.30
## CV residual      1.52  1.02 -2.22  0.686 -2.79 -0.326  7.5  1.35 -1.42  1.61
##                   263   793  2445  2663  1244  1593   2065  1456   256  1527
## Predicted       71.05 71.12 71.94 70.04 67.42 72.52 78.447 75.27 82.66 77.98
## cvpred          70.99 71.25 72.14 70.21 67.69 72.76 78.245 75.39 82.62 77.99
## Life.expectancy 69.50 75.10 74.50 69.20 64.70 74.00 78.500 73.00 77.60 72.80
## CV residual     -1.49  3.85  2.36 -1.01 -2.99  1.24  0.255 -2.39 -5.02 -5.19
##                  2509   2284  1212   252  1605   902  1083   1793  1210  2123
## Predicted       84.41 72.779 68.99 84.05 73.22 71.99 62.65 62.377 69.63 76.03
## cvpred          84.14 72.976 69.33 83.81 73.11 72.18 62.42 62.473 69.93 76.08
## Life.expectancy 81.70 72.900 67.30 78.80 77.90 69.40 56.40 63.200 67.70 74.40
## CV residual     -2.44 -0.076 -2.03 -5.01  4.79 -2.78 -6.02  0.727 -2.23 -1.68
##                    130  1610   1338   282  1476  2443  1351    27   932  1538
## Predicted       82.107 71.27 73.340 61.32 56.57 72.26 72.51 72.56 80.71 77.82
## cvpred          81.802 71.24 73.496 61.29 56.76 72.45 72.56 72.49 80.28 77.77
## Life.expectancy 81.400 75.90 73.100 56.80 52.10 74.70 68.50 73.50 82.20 71.60
## CV residual     -0.402  4.66 -0.396 -4.49 -4.66  2.25 -4.06  1.01  1.92 -6.17
##                  1973  868   933   589  1120   1464   686   390   119  2406
## Predicted       73.42 78.6 80.81 73.52 66.96 74.559 76.09 74.73 85.61 51.88
## cvpred          73.38 78.7 80.39 73.42 66.92 74.563 76.23 74.72 85.36 51.99
## Life.expectancy 75.70 77.3 82.00 72.40 65.30 74.900 78.50 73.40 81.70 54.00
## CV residual      2.32 -1.4  1.61 -1.02 -1.62  0.337  2.27 -1.32 -3.66  2.01
##                  2831   953   878  1064   518   863    568  1213   2225   935
## Predicted       70.23 67.35 74.47 68.36 52.28 53.30 73.840 71.71 66.036 76.29
## cvpred          70.26 67.26 74.33 68.32 52.45 52.74 74.083 71.92 65.932 76.26
## Life.expectancy 68.50 61.70 72.30 77.00 49.20 58.80 74.500 67.20 65.400 81.70
## CV residual     -1.76 -5.56 -2.03  8.68 -3.25  6.06  0.417 -4.72 -0.532  5.44
##                   949   994  2624   857  1217  1284  2269   40   302  2689  501
## Predicted       65.98 63.27 60.73 57.92 68.70 81.34 74.01 72.7 58.77 71.56 77.6
## cvpred          66.01 62.23 60.69 58.03 69.01 81.24 73.79 72.8 57.96 71.76 77.7
## Life.expectancy 64.60 71.80 56.70 61.40 66.50 82.50 74.90 74.1 62.50 73.50 81.5
## CV residual     -1.41  9.57 -3.99  3.37 -2.51  1.26  1.11  1.3  4.54  1.74  3.8
##                  2294 1573  1469    891  2499  2366  2207   1286  1872  1471
## Predicted       70.98 58.9 67.29 57.922 40.05 66.36 71.36 82.678 68.82 70.18
## cvpred          71.05 59.0 66.02 57.588 40.33 66.19 71.39 82.542 68.75 68.69
## Life.expectancy 72.10 56.7 73.90 58.500 47.80 68.50 76.00 82.000 71.20 73.50
## CV residual      1.05 -2.3  7.88  0.912  7.47  2.31  4.61 -0.542  2.45  4.81
##                   2695   2909  2580  2563  2230  2550  1662  2607 1524   260
## Predicted       71.792 63.307 69.92 68.30 65.52 69.64 62.09 68.42 76.9 70.57
## cvpred          71.877 63.338 70.03 68.35 65.28 69.67 62.18 68.59 76.8 70.52
## Life.expectancy 71.200 63.000 72.50 65.90 63.40 73.00 66.00 66.90 73.4 69.40
## CV residual     -0.677 -0.338  2.47 -2.45 -1.88  3.33  3.82 -1.69 -3.4 -1.12
##                  1385   836  1981   759  2408  2644 1472   2370   2823   2686
## Predicted       73.48 63.81 63.46 59.26 54.46 77.28 69.6 67.093 75.863 74.963
## cvpred          73.07 64.05 63.44 59.25 54.66 77.07 68.3 66.988 75.795 74.938
## Life.expectancy 65.20 57.90 61.80 61.30 56.00 72.30 73.2 67.600 75.400 74.500
## CV residual     -7.87 -6.15 -1.64  2.05  1.34 -4.77  4.9  0.612 -0.395 -0.438
##                  2915  2047   2156  1245   912  1977  1352 2407  2656   344
## Predicted       53.47 77.91 63.437 71.08 75.27 64.32 72.31 52.3 69.48 60.07
## cvpred          53.75 77.87 63.115 71.17 75.24 64.31 72.37 52.5 69.77 60.23
## Life.expectancy 52.60 75.50 63.800 66.80 67.90 62.70 67.80 54.9 71.00 57.50
## CV residual     -1.15 -2.37  0.685 -4.37 -7.34 -1.61 -4.57  2.4  1.23 -2.73
##                   112   640  2565   985   239   2272  1063  2034   285    460
## Predicted       71.31 74.74 68.38 71.59 71.30 73.869 68.09 67.88 60.39 70.693
## cvpred          71.31 74.68 68.42 71.68 71.15 73.651 68.07 68.08 60.38 70.533
## Life.expectancy 72.00 77.50 65.90 73.20 67.70 74.100 71.10 67.00 55.80 71.400
## CV residual      0.69  2.82 -2.52  1.52 -3.45  0.449  3.03 -1.08 -4.58  0.867
##                  2853  1029  1870  2273  2676  2822 2051  2427  2058  1373
## Predicted       62.61 79.62 69.29 72.58 75.95 77.13 77.2 81.30 77.59 55.23
## cvpred          61.59 79.38 69.18 72.56 75.83 76.89 77.3 81.47 77.61 55.32
## Life.expectancy 69.90 86.00 72.50 74.00 74.20 75.40 74.9 82.60 86.00 54.10
## CV residual      8.31  6.62  3.32  1.44 -1.63 -1.49 -2.4  1.13  8.39 -1.22
##                  2932  1479 1350  1563   678   1644  155   1549  1698  1097
## Predicted       52.51  63.6 71.3 63.29 77.42 78.781 70.7 78.377 72.77 57.76
## cvpred          52.34  63.3 71.5 63.31 77.44 78.729 70.8 78.453 72.83 57.75
## Life.expectancy 45.40  52.3 69.1 61.90 79.70 79.300 68.4 78.800 75.00 56.30
## CV residual     -6.94 -11.0 -2.4 -1.41  2.26  0.571 -2.4  0.347  2.17 -1.45
##                   483  1449   675  2641   820  2710  1545  2849   2288    829
## Predicted       60.74 77.18 77.51 74.66 71.58 61.55 77.38 68.49 71.265 71.221
## cvpred          60.76 77.22 77.82 74.58 71.49 60.55 77.49 68.52 71.423 71.174
## Life.expectancy 56.40 72.60 83.00 72.60 73.30 63.40 83.00 78.00 72.300 71.000
## CV residual     -4.36 -4.62  5.18 -1.98  1.81  2.85  5.51  9.48  0.877 -0.174
##                  2573   772   262  791  2917   983   599  1761  2060    573
## Predicted       71.05 71.87 70.68 72.5 52.42 72.97 64.78 68.57 78.34 73.565
## cvpred          71.14 71.78 70.63 72.5 52.51 72.81 64.75 68.56 78.29 73.811
## Life.expectancy 74.30 73.60 69.50 75.3 49.30 73.90 61.30 69.90 82.00 73.100
## CV residual      3.16  1.82 -1.13  2.8 -3.21  1.09 -3.45  1.34  3.71 -0.711
##                   2635  2255  1035  2659  1897    356  1238  2911  1557   2926
## Predicted       72.462 62.40 81.10 70.77 49.17 74.205 69.45 61.46 67.50 56.014
## cvpred          72.558 62.36 80.76 70.93 48.45 74.063 69.57 61.51 67.37 55.971
## Life.expectancy 73.300 64.30 79.40 69.60 52.70 74.500 76.00 58.20 64.70 56.600
## CV residual      0.742  1.94 -1.36 -1.33  4.25  0.437  6.43 -3.31 -2.67  0.629
##                  1382   515  1821   2439   199  1006  1214    571    689  1567
## Predicted       72.21 53.43 65.99 78.639 65.52 81.33 67.09 72.768 77.085 62.21
## cvpred          72.01 53.61 65.94 78.646 65.63 81.33 67.32 73.067 77.207 62.25
## Life.expectancy 65.70 49.90 67.00 79.500 69.50 79.10 65.30 73.900 78.100 59.90
## CV residual     -6.31 -3.71  1.06  0.854  3.87 -2.23 -2.02  0.833  0.893 -2.35
##                  950
## Predicted       65.5
## cvpred          65.5
## Life.expectancy 63.5
## CV residual     -2.0
## 
## Sum of squares = 2861    Mean square = 12.4    n = 231 
## 
## fold 3 
## Observations in test set: 231 
##                  1980   259  1078  2256  1528   397   491   1675   295 1623
## Predicted       64.03 73.42 59.89 62.02 75.59 73.83 60.41 72.290 61.13 58.8
## cvpred          64.16 73.19 59.94 62.06 75.44 73.84 60.01 72.201 61.07 58.8
## Life.expectancy 62.00 69.80 58.40 63.50 72.40 72.00 52.80 72.700 67.40 56.8
## CV residual     -2.16 -3.39 -1.54  1.44 -3.04 -1.84 -7.21  0.499  6.33 -2.0
##                   202   588  2507  2671   136   455  1492   1656   1112  2732
## Predicted       65.22 70.80 79.76 76.19 80.30 70.25 59.84 62.248 66.727 72.42
## cvpred          65.14 70.77 79.48 75.91 80.51 70.15 59.98 62.342 66.772 71.91
## Life.expectancy 68.20 72.80 82.30 74.80 84.00 72.40 58.10 62.200 65.900 78.00
## CV residual      3.06  2.03  2.82 -1.11  3.49  2.25 -1.88 -0.142 -0.872  6.09
##                  1588    25  1079  2711   900   2137   952    407     42   942
## Predicted       72.94 73.29 63.57 61.93 76.46 73.649 63.68 57.193 72.503 78.69
## cvpred          72.86 73.08 63.31 62.03 76.21 73.647 63.74 57.243 72.483 78.79
## Life.expectancy 74.80 75.90 58.10 63.30 69.70 73.000 62.30 56.900 73.400 82.00
## CV residual      1.94  2.82 -5.21  1.27 -6.51 -0.647 -1.44 -0.343  0.917  3.21
##                   143    500  1579  2672   111  1194    408  1205   1736  2139
## Predicted       77.30 81.721 49.58 76.47 71.15 59.83 56.331 70.80 76.164 72.25
## cvpred          77.28 81.902 49.75 76.21 71.11 58.53 56.408 70.72 75.728 72.27
## Life.expectancy 78.60 81.600 48.50 74.70 72.60 65.50 56.100 68.70 75.600 69.60
## CV residual      1.32 -0.302 -1.25 -1.51  1.49  6.97 -0.308 -2.02 -0.128 -2.67
##                   459   240  1294  2436  1081    948    52  2583   426  1594
## Predicted       68.76 70.98 80.89 76.97 58.30 66.354 59.71 68.52 55.96 72.38
## cvpred          68.66 71.07 80.81 76.68 58.34 66.311 59.83 68.48 56.05 72.32
## Life.expectancy 71.80 68.00 89.00 81.00 57.30 65.500 56.00 71.40 54.10 73.80
## CV residual      3.14 -3.07  8.19  4.32 -1.04 -0.811 -3.83  2.92 -1.95  1.48
##                  1606  1310  1676   934  1869  1607  1467   144  2209  1309
## Predicted       72.56 69.65 72.41 78.02 69.59 71.75 72.48 77.12 69.79 71.08
## cvpred          72.29 69.65 72.34 77.73 69.56 71.51 72.21 77.09 69.58 71.05
## Life.expectancy 77.60 73.30 72.90 81.50 72.50 77.30 74.40 78.10 72.20 73.50
## CV residual      5.31  3.65  0.56  3.77  2.94  5.79  2.19  1.01  2.62  2.45
##                  2648   1822   1252   121  2661    2685  2377  1192   871
## Predicted       73.86 65.782 81.156 82.63 73.29 74.8609 63.95 63.90 78.15
## cvpred          73.85 65.707 80.918 82.38 73.06 74.7436 64.12 63.13 78.05
## Life.expectancy 71.80 66.600 81.200 81.30 69.40 74.8000 65.80 66.40 76.10
## CV residual     -2.05  0.893  0.282 -1.08 -3.66  0.0564  1.68  3.27 -1.95
##                   1069  1362    406  1732  1036  2844  941   1601 2478  1988
## Predicted       69.893 69.75 57.709 66.19 78.43 68.60 78.8 72.093 71.1 61.38
## cvpred          69.694 69.92 57.754 66.38 78.16 68.55 78.9 72.052 71.1 61.58
## Life.expectancy 69.200 63.90 57.500 62.80 79.70 71.70 81.0 72.700 76.0 59.60
## CV residual     -0.494 -6.02 -0.254 -3.58  1.54  3.15  2.1  0.648  4.9 -1.98
##                  2501   131   2274   594  1065  270   233   1948  2011  1335
## Predicted       43.83 78.16 72.919 68.70 68.20 70.6 72.71 65.661 72.98 74.09
## cvpred          43.37 77.89 72.962 68.39 68.21 70.6 72.72 65.577 72.91 73.94
## Life.expectancy 45.60 81.10 73.800 63.20 76.00 68.5 69.80 65.100 74.90 73.60
## CV residual      2.23  3.21  0.838 -5.19  7.79 -2.1 -2.92 -0.477  1.99 -0.34
##                  2400   797 1755   552  1624   342   102  1787    1236    21
## Predicted       56.61 72.26 70.1 76.43 58.08 64.58 71.76 61.91 67.8186 73.62
## cvpred          56.69 72.19 70.1 76.24 58.03 64.72 71.72 61.88 67.8468 73.49
## Life.expectancy 56.50 74.20 72.3 79.60 56.50 61.10 73.50 65.20 67.9000 76.60
## CV residual     -0.19  2.01  2.2  3.36 -1.53 -3.62  1.78  3.32  0.0532  3.11
##                   2643   566  2374    88   2219   585  1340    451    30  1625
## Predicted       72.866 73.89 63.52 77.15 66.909 71.66 75.24 73.273 72.87 57.86
## cvpred          72.654 73.69 63.52 77.02 66.741 71.62 75.08 72.981 72.68 57.81
## Life.expectancy 72.400 75.00 66.80 75.40 67.300 73.50 72.80 72.800 73.30 56.00
## CV residual     -0.254  1.31  3.28 -1.62  0.559  1.88 -2.28 -0.181  0.62 -1.81
##                   269   676   2646  576  2728  2561   998  1144  1879    93
## Predicted       72.94 76.40 72.299 70.2 52.81 68.41 77.38 69.89 56.56 77.13
## cvpred          72.75 76.25 72.172 69.9 52.88 68.37 77.19 69.79 56.54 76.93
## Life.expectancy 68.40 81.00 72.000 71.7 48.80 66.40 86.00 73.60 61.40 74.10
## CV residual     -4.35  4.75 -0.172  1.8 -4.08 -1.97  8.81  3.81  4.86 -2.83
##                  1874  1899  2251  831  2068  1360   2261  2566   114 1789
## Predicted       68.82 48.51 64.05 73.4 79.90 70.41 60.361 67.74 88.94 63.0
## cvpred          68.83 48.05 64.04 73.2 79.68 70.56 60.443 67.74 88.85 63.1
## Life.expectancy 76.00 52.00 66.40 69.9 77.30 64.70 59.700 65.20 82.70 64.5
## CV residual      7.17  3.95  2.36 -3.3 -2.38 -5.86 -0.743 -2.54 -6.15  1.4
##                   858  1240   386   603   452   628    148  1968   648  1447
## Predicted       57.99 69.27 74.95 63.92 71.18 74.57 71.855 72.70 76.21 75.82
## cvpred          58.25 69.27 74.86 63.99 71.01 74.35 71.776 72.58 75.92 75.79
## Life.expectancy 67.00 76.00 74.30 60.00 72.70 79.40 71.900 76.40 76.30 73.60
## CV residual      8.75  6.73 -0.56 -3.99  1.69  5.05  0.124  3.82  0.38 -2.19
##                    86  107  1209   124  1380  1548   1945    775  2828   2030
## Predicted       77.02 68.7 69.52 82.69 71.99 83.55 65.674 73.546 70.52 68.333
## cvpred          76.83 68.6 69.46 82.25 71.89 83.91 65.586 73.357 70.48 68.305
## Life.expectancy 75.50 73.0 67.90 86.00 66.10 79.40 66.000 73.100 69.20 68.000
## CV residual     -1.33  4.4 -1.56  3.75 -5.79 -4.51  0.414 -0.257 -1.28 -0.305
##                    98   758   399    44   951  1024   100  2562  1562   2226
## Predicted       73.71 59.76 76.01 73.54 64.28 63.72 72.25 68.49 63.42 66.030
## cvpred          73.51 59.85 75.85 73.36 64.36 63.48 72.19 68.46 63.45 65.999
## Life.expectancy 74.60 61.80 71.60 72.30 62.80 57.60 74.40 66.10 62.30 65.100
## CV residual      1.09  1.95 -4.25 -1.06 -1.56 -5.88  2.21 -2.36 -1.15 -0.899
##                  2301   506   1792  1533  2564   418   2449  1660   1291  2292
## Predicted        60.7 78.90 62.507 76.24 68.14 63.06 71.582 62.23 81.831 69.35
## cvpred           60.8 78.64 62.592 76.32 68.12 63.06 71.506 62.32 81.774 69.29
## Life.expectancy  49.7 85.00 63.500 78.00 65.50 59.10 72.300 61.20 81.300 72.20
## CV residual     -11.1  6.36  0.908  1.68 -2.62 -3.96  0.794 -1.12 -0.474  2.91
##                    1831  1604   2018   600  1725  1241  1867   756    402  2553
## Predicted       81.8819 74.00 72.110 64.26 73.77 69.48 68.54 60.49 59.838 69.58
## cvpred          81.7847 73.63 72.049 64.25 73.53 69.48 68.38 60.55 59.893 69.57
## Life.expectancy 81.7000 78.20 72.800 61.00 65.90 74.00 73.20 62.70 59.300 72.60
## CV residual     -0.0847  4.57  0.751 -3.25 -7.63  4.52  4.82  2.15 -0.593  3.03
##                  2121  1529  2742   105   562  2500  1030   2448   2154  1791
## Predicted       75.99 77.33 72.22 71.25 73.90 45.00 79.49 71.400 64.975 62.47
## cvpred          75.94 77.33 72.26 71.21 73.68 44.52 79.27 71.336 64.862 62.54
## Life.expectancy 74.80 72.20 67.40 73.50 75.80 46.00 84.00 71.800 65.200 63.90
## CV residual     -1.14 -5.13 -4.86  2.29  2.12  1.48  4.73  0.464  0.338  1.36
##                  1769   503   798   326  1487   322  1589   1773  2305   339
## Predicted       60.53 78.83 72.21 73.87 42.20 74.56 72.51 51.790  56.4 67.83
## cvpred          60.12 78.53 72.12 73.65 42.42 74.31 72.41 51.924  56.7 67.87
## Life.expectancy 54.30 81.00 74.40 76.40 45.50 77.20 74.60 52.100  46.2 64.20
## CV residual     -5.82  2.47  2.28  2.75  3.08  2.89  2.19  0.176 -10.5 -3.67
##                   1559  1470  2609   1010  1825  1790   579   2690   875  1278
## Predicted       64.250 67.82 67.77 78.379 63.17 65.76 72.29 73.086 75.31 78.19
## cvpred          64.252 67.33 67.75 78.415 63.07 65.59 72.18 73.003 75.32 77.86
## Life.expectancy 63.800 73.70 66.20 78.000 64.70 64.20 74.40 73.200 73.00 81.00
## CV residual     -0.452  6.37 -1.55 -0.415  1.63 -1.39  2.22  0.197 -2.32  3.14
##                    644   1647  1540   785  1452    987   1483     32  1575
## Predicted       76.875 78.063 81.99 69.62 76.52 74.110 45.615 72.983 56.75
## cvpred          76.804 77.974 82.22 69.58 76.58 73.838 45.888 72.788 56.76
## Life.expectancy 77.700 78.500 81.70 71.20 75.00 74.400 46.200 72.600 54.10
## CV residual      0.896  0.526 -0.52  1.62 -1.58  0.562  0.312 -0.188 -2.66
##                   551   2576  2705  1303   331   467  1394 2134 2009   505
## Predicted       76.44 73.450 61.03 71.77 65.91 66.68 61.72 72.2 73.4 82.09
## cvpred          76.24 73.209 61.16 71.69 65.47 66.59 61.69 72.3 73.3 82.05
## Life.expectancy 79.30 73.700 64.50 75.20 75.00 67.80 64.10 78.0 75.3 85.00
## CV residual      3.06  0.491  3.34  3.51  9.53  1.21  2.41  5.7  2.0  2.95
##                   423    646   2681
## Predicted       59.13 77.955 73.608
## cvpred          59.23 77.791 73.513
## Life.expectancy 56.20 77.000 72.900
## CV residual     -3.03 -0.791 -0.613
## 
## Sum of squares = 2584    Mean square = 11.2    n = 231 
## 
## fold 4 
## Observations in test set: 231 
##                    55    24  2908   469    643  1474   238 1082    34  2837
## Predicted       56.37 73.76 64.17 69.06 76.961 68.45 71.26 61.6 76.36 70.06
## cvpred          56.49 73.88 64.12 69.37 77.298 68.55 71.11 62.0 76.57 69.97
## Life.expectancy 49.10 75.30 61.10 67.00 77.800 72.70 67.20 56.8 75.40 67.30
## CV residual     -7.39  1.42 -3.02 -2.37  0.502  4.15 -3.91 -5.2 -1.17 -2.67
##                  2141  2369   109    16   1681  1693   638  1817  1014   488
## Predicted       71.52 66.03 70.77 57.68 71.067 73.42 75.15 66.66 65.85 57.05
## cvpred          71.44 66.09 70.72 57.96 70.928 73.34 75.33 67.01 65.83 56.96
## Life.expectancy 68.40 68.00 72.70 54.80 71.500 75.80 78.00 68.90 61.60 54.20
## CV residual     -3.04  1.91  1.98 -3.16  0.572  2.46  2.67  1.89 -4.23 -2.76
##                  1448  2202  2582   914   687 2055   554 1384  1784   855
## Predicted       79.07 72.63 68.96 68.83 75.87 76.4 76.65 72.3 66.93 58.25
## cvpred          79.41 72.76 68.84 68.84 76.05 76.5 76.59 72.2 67.07 58.21
## Life.expectancy 72.80 73.80 71.70 67.70 78.40 73.7 78.90 65.3 65.90 62.90
## CV residual     -6.61  1.04  2.86 -1.14  2.35 -2.8  2.31 -6.9 -1.17  4.69
##                    944   2042  1536   327   2477   945     2  1355  1654   1678
## Predicted       79.317 76.200 78.66 72.14 71.086 80.30 63.37 71.87 64.01 71.830
## cvpred          78.955 76.711 78.94 72.56 71.112 80.39 63.68 71.55 64.39 71.711
## Life.expectancy 79.200 77.100 71.40 76.10 71.300 79.00 59.90 65.30 62.70 72.100
## CV residual      0.245  0.389 -7.54  3.54  0.188 -1.39 -3.78 -6.25 -1.69  0.389
##                   800  2839    861  2835  2070  1881 2936   1991  1345  1882
## Predicted       71.85 69.90 58.536 70.05 78.52 56.23 48.2 60.040 74.62 55.88
## cvpred          71.73 69.81 58.884 70.03 79.01 56.54 48.2 59.864 74.69 56.19
## Life.expectancy 73.60 67.20 59.400 67.80 76.90 63.00 44.8 58.900 71.90 59.40
## CV residual      1.87 -2.61  0.516 -2.23 -2.11  6.46 -3.4 -0.964 -2.79  3.21
##                    956  1595   152  773  1653   1950   122   627   2637  2260
## Predicted       61.787 72.19 71.26 71.2 65.24 64.330 86.37 74.59 74.001 60.52
## cvpred          61.576 72.04 71.18 71.2 65.52 64.446 86.48 74.82 73.937 60.58
## Life.expectancy 61.400 73.70 73.00 73.4 63.00 64.600 81.20 79.50 73.000 65.00
## CV residual     -0.176  1.66  1.82  2.2 -2.52  0.154 -5.28  4.68 -0.937  4.42
##                    590  1611  1339  1349  1121   1671  1612  1143  2912  2216
## Predicted       70.980 71.15 76.70 75.74 67.18 73.596 71.56 69.94 60.63 74.52
## cvpred          70.913 71.32 76.87 75.79 67.08 73.518 71.73 70.14 60.51 74.51
## Life.expectancy 71.800 75.40 73.00 69.50 65.40 73.900 75.00 73.90 58.00 72.00
## CV residual      0.887  4.08 -3.87 -6.29 -1.68  0.382  3.27  3.76 -2.51 -2.51
##                  2623  1076   106  2162   2035   517  1149   1068   1482  2847
## Predicted       62.08 60.17 70.72 62.25 68.386 52.79 68.93 70.408 47.720 68.51
## cvpred          62.08 60.36 70.64 62.59 68.248 52.74 69.02 70.663 47.378 68.53
## Life.expectancy 57.40 58.10 72.90 55.30 67.300 49.80 72.50 69.700 47.800 71.20
## CV residual     -4.68 -2.26  2.26 -7.29 -0.948 -2.94  3.48 -0.963  0.422  2.67
##                  1800   2375   2019  2740    3   1578 1883   2409  1969  2838
## Predicted       66.84 67.077 72.057 72.05 63.4 50.359 53.7 56.470 73.31 70.10
## cvpred          66.94 67.346 71.947 71.91 63.7 49.863 54.1 56.311 73.33 70.01
## Life.expectancy 65.80 66.500 72.200 67.70 59.9 50.000 58.2 57.300 76.20 67.80
## CV residual     -1.14 -0.846  0.253 -4.21 -3.8  0.137  4.1  0.989  2.87 -2.21
##                  2302   1955  2647   251  1457  2704  2608  1376    1778   1949
## Predicted        59.7 62.697 73.92 79.07 74.59 61.22 68.28 52.13 49.9438 65.188
## cvpred           60.0 62.706 73.78 79.36 74.64 61.34 68.19 51.82 49.8503 65.235
## Life.expectancy  48.9 63.500 71.90 78.90 69.90 65.60 66.60 52.10 49.8000 64.800
## CV residual     -11.1  0.794 -1.88 -0.46 -4.74  4.26 -1.59  0.28 -0.0503 -0.435
##                  2482  1655     354   910   1680  1863    1466  1273   205
## Predicted       72.73 63.60 74.6449 72.21 71.408 70.30 74.2685 78.62 64.07
## cvpred          72.84 63.96 74.8181 71.94 71.253 70.55 74.4213 78.64 64.06
## Life.expectancy 69.50 62.50 74.8000 68.10 71.500 74.50 74.5000 81.50 66.80
## CV residual     -3.34 -1.46 -0.0181 -3.84  0.247  3.95  0.0787  2.86  2.74
##                    937    405    649  2913   275  2041   1375  2215   936  1697
## Predicted       80.698 58.076 76.741 59.39 63.30 79.04 52.073 71.77 75.97 72.70
## cvpred          80.725 58.216 76.975 59.25 63.38 79.42 51.807 71.61 76.35 72.61
## Life.expectancy 81.100 58.100 76.000 57.40 59.50 77.30 52.400 75.00 81.30 75.00
## CV residual      0.375 -0.116 -0.975 -1.85 -3.88 -2.12  0.593  3.39  4.95  2.39
##                   586 1391  1757  1446  2049  630  2300  2551    574 2503  1206
## Predicted       71.07 61.1 67.95 76.09 76.10 75.1  66.4 69.63 73.099 36.3 70.63
## cvpred          71.07 61.8 68.06 76.27 76.28 75.3  67.1 69.58 73.236 35.5 70.55
## Life.expectancy 73.10 64.7 71.40 73.80 75.20 79.0  54.0 72.80 72.700 46.4 68.50
## CV residual      2.03  2.9  3.34 -2.47 -1.08  3.7 -13.1  3.22 -0.536 10.9 -2.05
##                  1271   790   2437  2745  2552  1983  2723    17  1776     149
## Predicted       80.08 72.54 80.169 71.50 69.63 66.80 61.60 74.58 49.97 71.5221
## cvpred          80.01 72.63 80.366 71.27 69.57 67.03 62.19 74.67 49.82 71.5055
## Life.expectancy 81.80 75.50 81.000 67.70 72.70 61.40 55.50 77.80 54.00 71.6000
## CV residual      1.79  2.87  0.634 -3.57  3.13 -5.63 -6.69  3.13  4.18  0.0945
##                   254   997   1333    258   1944  828   2440  1751     1657
## Predicted       81.90 80.13 73.979 69.344 65.710 69.9 79.783 71.83 61.98428
## cvpred          82.16 80.64 74.035 69.455 65.781 69.9 79.933 71.92 61.99857
## Life.expectancy 78.00 86.00 73.900 70.000 66.200 75.0 79.400 73.90 62.00000
## CV residual     -4.16  5.36 -0.135  0.545  0.419  5.1 -0.533  1.98  0.00143
##                  1007  2557 1218   2819  2493  2397  2674  1016  2567    11
## Predicted       80.03 69.03 68.7 75.749 58.33 68.68 76.31 64.48 67.32 61.08
## cvpred          80.04 69.12 68.5 75.839 58.29 69.01 76.37 64.47 67.24 61.36
## Life.expectancy 78.50 68.80 66.3 75.400 56.50 59.20 74.60 69.00 64.30 57.30
## CV residual     -1.54 -0.32 -2.2 -0.439 -1.79 -9.81 -1.77  4.53 -2.94 -4.06
##                    575  2363   784 1687  1023   1672  2824  1300   404  2268
## Predicted       72.974 66.13 69.71 73.1 62.74 73.099 75.67 71.78 56.87 73.20
## cvpred          73.113 66.23 69.64 73.1 62.99 73.049 75.65 71.79 57.22 72.98
## Life.expectancy 72.200 68.80 71.40 76.3 57.90 73.600 75.40 75.80 58.60 75.30
## CV residual     -0.913  2.57  1.76  3.2 -5.09  0.551 -0.25  4.01  1.38  2.32
##                   1282  1060  2223   365   486  1386  2584   888   2161   639
## Predicted       78.632 67.81 68.98 75.10 63.66 73.32 68.84 58.31 58.317 73.20
## cvpred          78.556 67.91 69.22 75.07 63.96 73.79 68.65 58.63 58.057 73.29
## Life.expectancy 78.900 71.70 66.20 71.80 55.30 65.10 71.20 61.80 57.600 78.30
## CV residual      0.344  3.79 -3.02 -3.27 -8.66 -8.69  2.55  3.17 -0.457  5.01
##                   343  2854   2290  1353   2048  2069 1381  1153   328  2016
## Predicted       62.71 62.81 71.405 72.82 75.987 80.18 72.2 67.87 73.41 71.20
## cvpred          62.45 63.07 71.213 72.59 76.186 80.56 72.1 67.88 73.59 71.22
## Life.expectancy 59.20 69.60 72.200 67.80 75.300 77.20 65.8 71.30 76.00 74.00
## CV residual     -3.25  6.53  0.987 -4.79 -0.886 -3.36 -6.3  3.42  2.41  2.78
##                  2159  1196  1694  2142  1574   645     6  2818  1558   156
## Predicted       62.07 65.24 73.62 71.81  64.7 78.05 62.74 74.41 62.66 70.63
## cvpred          62.22 65.89 73.56 71.75  65.3 78.45 63.06 74.63 62.84 70.72
## Life.expectancy 68.00 64.80 75.30 68.20  55.3 77.10 58.80 76.40 64.30 68.40
## CV residual      5.78 -1.09  1.74 -3.55 -10.0 -1.35 -4.26  1.77  1.46 -2.32
##                  1198  2267   1762  330  1346  1995  2938   685   2813  1779
## Predicted       64.26 72.88 70.211 74.5 74.34 70.20 38.11 76.76 75.925 55.47
## cvpred          64.67 72.72 70.302 74.8 74.41 70.02 37.43 76.96 76.074 55.73
## Life.expectancy 64.00 75.40 69.500 75.7 71.70 73.60 46.00 78.60 76.800 49.50
## CV residual     -0.67  2.68 -0.802  0.9 -2.71  3.58  8.57  1.64  0.726 -6.23
##                  2622  1152     2028  939    84   2032  2548  1987   580  1147
## Predicted       67.46 67.01 68.03699 76.9 79.17 68.182 68.74 60.58 72.98 71.37
## cvpred          67.76 67.12 68.00559 76.6 79.22 68.104 68.85 60.75 73.02 71.64
## Life.expectancy 58.30 71.60 68.00000 89.0 75.90 67.500 73.50 59.90 74.30 73.00
## CV residual     -9.46  4.48 -0.00559 12.4 -3.32 -0.604  4.65 -0.85  1.28  1.36
##                  1699  1388 2845  2724  2703   2816  1477   635   428  1734
## Predicted       72.53 69.96 68.5 61.53 61.51 77.006 58.00 75.16 53.75 77.51
## cvpred          72.39 69.67 68.5 62.14 61.63 77.059 58.03 75.31 53.83 77.62
## Life.expectancy 74.80 65.00 71.6 54.90 65.80 76.300 52.10 78.00 52.60 75.90
## CV residual      2.41 -4.67  3.1 -7.24  4.17 -0.759 -5.93  2.69 -1.23 -1.72
##                  2935    56
## Predicted       39.21 57.13
## cvpred          38.58 57.08
## Life.expectancy 44.50 48.70
## CV residual      5.92 -8.38
## 
## Sum of squares = 3308    Mean square = 14.3    n = 231 
## 
## fold 5 
## Observations in test set: 231 
##                  1999  2286    569   647  1572   1034  1691  1077   2270   346
## Predicted       70.32 71.27 73.499 75.27 60.78 79.533 73.01 60.36 73.662 57.75
## cvpred          70.31 71.43 73.577 75.14 60.61 79.674 72.97 60.32 73.652 57.69
## Life.expectancy 72.70 72.60 74.400 76.60 57.60 79.900 75.60 58.80 74.600 54.80
## CV residual      2.39  1.17  0.823  1.46 -3.01  0.226  2.63 -1.52  0.948 -2.89
##                   1598   400    41  905  2431   116   125  1494    90   591
## Predicted       72.698 73.89 71.09 75.8 79.50 88.41 84.12 60.67 76.95 69.28
## cvpred          72.661 73.74 71.08 76.0 79.29 88.76 84.19 60.57 77.07 68.99
## Life.expectancy 73.200 71.10 73.80 68.9 81.90 82.30 83.00 67.00 75.20 71.50
## CV residual      0.539 -2.64  2.72 -7.1  2.61 -6.46 -1.19  6.43 -1.87  2.51
##                  1994   827  1343    1253  2153  2833  1621  2604  1341  2444
## Predicted       70.13 72.53 74.87 81.2222 68.19 69.05 59.39 68.75 75.15 72.14
## cvpred          70.25 72.66 74.75 81.0859 68.37 69.01 59.34 68.82 75.01 72.13
## Life.expectancy 73.80 71.20 72.30 81.0000 65.70 68.00 57.30 67.70 72.40 74.60
## CV residual      3.55 -1.46 -2.45 -0.0859 -2.67 -1.01 -2.04 -1.12 -2.61  2.47
##                  1387  2126  1040 1368  2547  1758   255  1256  1990   2683
## Predicted       71.17 75.60 76.89 60.7 69.04 69.48 84.17 82.86 60.53 76.363
## cvpred          70.99 75.46 76.86 60.5 68.76 69.52 84.25 82.89 60.32 76.404
## Life.expectancy 65.00 73.10 79.00 63.0 73.70 71.00 78.00 86.00 59.10 75.500
## CV residual     -5.99 -2.36  2.14  2.5  4.94  1.48 -6.25  3.11 -1.22 -0.904
##                  2502  2605  2071  1304   2693   1334   799  1038   246   249
## Predicted       44.48 68.86 77.74 70.62 72.471 73.745 72.09 77.28 77.95 77.27
## cvpred          44.79 68.94 77.69 70.59 72.417 73.592 72.07 77.31 77.93 77.02
## Life.expectancy 45.90 67.40 76.60 75.00 72.000 73.700 74.40 79.20 80.00 79.50
## CV residual      1.11 -1.54 -1.09  4.41 -0.417  0.108  2.33  1.89  2.07  2.48
##                   420  284   1039   1119  1580  2125  2505  2653 1971     38
## Predicted       62.49 60.2 78.109 65.315 48.42 76.62 39.04 71.63 73.6 74.019
## cvpred          62.57 60.2 78.216 65.058 48.36 76.51 38.98 71.59 73.6 74.014
## Life.expectancy 58.00 56.1 79.100 65.300 47.10 73.40 48.40 78.00 75.8 74.700
## CV residual     -4.57 -4.1  0.884  0.242 -1.26 -3.11  9.42  6.41  2.2  0.686
##                  1458  1276  2138   304   532  2003  1824   1764  2744   419
## Predicted       74.19 78.73 73.43 57.96 53.92 70.50 67.59 69.349 72.06 67.02
## cvpred          74.01 78.59 73.43 58.54 53.69 70.59 67.74 69.508 72.09 67.31
## Life.expectancy 71.00 84.00 70.00 62.00 51.80 71.90 65.40 68.600 67.60 58.60
## CV residual     -3.01  5.41 -3.43  3.46 -1.89  1.31 -2.34 -0.908 -4.49 -8.71
##                   274  1636   2924   2046  2054  1767  1111   2925    348  2722
## Predicted       63.68 77.41 59.376 76.766 76.75 62.81 66.84 58.152 48.910 61.98
## cvpred          63.74 77.09 59.418 76.637 76.59 63.06 66.83 58.188 48.755 62.33
## Life.expectancy 59.70 81.40 59.200 75.700 74.20 55.30 65.60 58.000 48.100 56.30
## CV residual     -4.04  4.31 -0.218 -0.937 -2.39 -7.76 -1.23 -0.188 -0.655 -6.03
##                  1537  1269   338   519  1600  2696  2130  1306  2814    982
## Predicted       77.97 80.32 68.51 52.14 74.07 73.68 74.35 71.91 75.96 74.642
## cvpred          77.96 80.34 68.35 51.98 74.11 73.75 74.19 71.86 75.93 74.674
## Life.expectancy 71.20 82.10 65.10 48.60 72.90 78.00 71.90 74.50 76.50 74.200
## CV residual     -6.76  1.76 -3.25 -3.38 -1.21  4.25 -2.29  2.64  0.57 -0.474
##                  1211  1771  2651   198    358  2738  1730   410 2157 1880
## Predicted       71.04 59.92 71.69 66.04 74.023 70.28 67.69 58.93 66.2 56.5
## cvpred          71.07 60.26 71.65 66.12 74.092 70.01 67.63 59.26 66.6 56.5
## Life.expectancy 67.50 53.80 71.10 69.90 73.800 67.70 63.80 54.30 62.8 69.0
## CV residual     -3.57 -6.46 -0.55  3.78 -0.292 -2.31 -3.83 -4.96 -3.8 12.5
##                   141   1268   403  1964  1019  1301   679  2140  1722 2848
## Predicted       76.49 81.170 62.76 72.66 66.51 71.70 77.20 71.85 74.50 68.7
## cvpred          76.46 81.226 63.09 72.57 66.69 71.63 77.02 71.83 74.73 68.6
## Life.expectancy 78.80 82.200 59.00 77.30 59.90 75.60 79.50 69.40 66.30 71.0
## CV residual      2.34  0.974 -4.09  4.73 -6.79  3.97  2.48 -2.43 -8.43  2.4
##                  363  1197   2496    357 1641  2508   2020  1989   1453  1984
## Predicted       74.1 62.21 53.359 74.259 77.0 79.85 72.656 61.02 76.015 62.63
## cvpred          74.1 62.68 53.563 74.305 76.7 79.46 72.748 60.81 75.858 62.58
## Life.expectancy 72.7 64.40 52.600 74.100 82.0 81.90 72.100 59.30 76.000 61.10
## CV residual     -1.4  1.72 -0.963 -0.205  5.3  2.44 -0.648 -1.51  0.142 -1.48
##                  2574  1583   778   325  1550   1739 1461  2669 2735   104
## Predicted       71.63 46.63 70.53 73.50 82.19 75.162 73.9 76.49 73.9 72.09
## cvpred          71.74 46.63 70.57 73.42 82.48 75.166 73.7 76.58 73.8 72.16
## Life.expectancy 74.10 44.60 73.30 76.90 78.70 75.000 74.9 74.90 75.0 73.20
## CV residual      2.36 -2.03  2.73  3.48 -3.78 -0.166  1.2 -1.68  1.2  1.04
##                    10   1374  2452 2581   2285  1450    2721  1293   859   794
## Predicted       61.08 53.399 72.04 69.7 72.318 76.31 57.4302 81.26 57.80 72.49
## cvpred          60.98 53.356 72.04 69.8 72.197 76.15 57.5586 81.22 57.78 72.52
## Life.expectancy 57.30 53.000 74.20 71.6 72.700 71.90 57.5000 88.00 62.00 74.60
## CV residual     -3.68 -0.356  2.16  1.8  0.503 -4.25 -0.0586  6.78  4.22  2.08
##                   142   227   890  2062   1008  1688  2368   1332   473    2026
## Predicted       80.71 76.61 56.14 78.12 78.641 71.78 66.45 73.681 68.02 68.0461
## cvpred          80.95 76.92 56.25 78.27 78.667 71.77 66.45 73.546 68.28 68.0004
## Life.expectancy 78.70 71.70 59.80 79.30 78.400 76.10 68.10 74.000 65.00 68.1000
## CV residual     -2.25 -5.22  3.55  1.03 -0.267  4.33  1.65  0.454 -3.28  0.0996
##                  1003    135    91   103   514  2211 2454   874  1617  1444
## Predicted       82.31 81.447 77.04 70.04 54.10 73.67 71.9 75.07 70.51 76.04
## cvpred          82.64 81.442 77.14 69.99 53.94 73.68 71.9 75.24 70.63 75.71
## Life.expectancy 79.80 82.000 74.90 73.30 58.00 71.60 73.9 74.20 78.00 74.40
## CV residual     -2.84  0.558 -2.24  3.31  4.06 -2.08  2.0 -1.04  7.37 -1.31
##                   456  1637  1020    368   323  1871  1547  2135  1061   2483
## Predicted       70.14 77.21 61.71 74.708 75.57 71.43 76.42 72.06 68.21 69.778
## cvpred          70.34 76.91 61.69 74.823 75.55 71.56 76.16 71.96 68.14 69.679
## Life.expectancy 72.40 81.10 59.40 75.000 77.00 73.00 79.70 77.00 71.40 69.300
## CV residual      2.06  4.19 -2.29  0.177  1.45  1.44  3.54  5.04  3.26 -0.379
##                  2559  1834   873    261  2673   157   2277  760  2229    291
## Predicted       68.98 79.97 76.07 70.370 76.14 70.44 73.403 59.0 65.51 68.068
## cvpred          68.93 79.95 76.26 70.397 76.27 70.27 73.397 58.8 65.54 68.135
## Life.expectancy 67.30 81.10 74.90 69.400 74.70 67.80 73.000 69.0 63.80 69.100
## CV residual     -1.63  1.15 -1.36 -0.997 -1.57 -2.47 -0.397 10.2 -1.74  0.965
##                  2398   2642  1685    993   876  2680  1613  2826  1729  1371
## Predicted       62.23 72.718 73.01 72.362 74.76 75.39 71.97 73.43 66.92 58.03
## cvpred          62.03 72.739 72.93 72.279 74.97 75.57 71.98 73.15 66.81 58.05
## Life.expectancy 58.90 72.500 76.60 73.000 73.00 73.20 74.30 75.10 64.00 56.80
## CV residual     -3.13 -0.239  3.67  0.721 -1.97 -2.37  2.32  1.95 -2.81 -1.25
##                 1866  2858 2057  2404  2701   280 1190 1359  2306   2815 2655
## Predicted       68.7 64.34 76.9 51.02 71.21 61.64 72.5 70.7  61.9 76.069 69.8
## cvpred          68.7 65.29 76.7 50.98 71.36 61.69 72.9 70.7  62.3 76.068 69.4
## Life.expectancy 74.5 69.00 89.0 53.80 65.60 57.60 67.3 64.4  45.3 77.000 74.0
## CV residual      5.8  3.71 12.3  2.82 -5.76 -4.09 -5.6 -6.3 -17.0  0.932  4.6
##                    57    393  1451    26   530  2146  2914  1116   1801  1460
## Predicted       56.70 72.521 75.94 70.29 55.09 70.83 63.21 71.22 64.610 73.72
## cvpred          56.79 72.365 75.76 70.29 54.94 70.88 63.51 71.47 64.528 73.55
## Life.expectancy 48.20 72.600 78.00 74.20 52.60 65.00 55.70 65.20 64.300 74.80
## CV residual     -8.59  0.235  2.24  3.91 -2.34 -5.88 -7.81 -6.27 -0.228  1.25
##                   290  1986   1296  1037   82  1875   629  2649  1596   1365
## Predicted       68.13 66.08 79.853 77.02 77.3 68.53 75.47 74.26 72.55 63.374
## cvpred          68.21 66.18 79.758 77.13 77.5 68.55 75.43 74.31 72.51 63.399
## Life.expectancy 69.40 64.00 80.000 79.30 76.2 75.00 79.20 71.60 73.60 62.600
## CV residual      1.19 -2.18  0.242  2.17 -1.3  6.45  3.77 -2.71  1.09 -0.799
##                  1383   19  1498  1661  1750    1645  1568  2376   2667  2129
## Predicted       72.35 74.5 62.46 61.87 71.81 79.2128 62.01 63.60 74.683 74.61
## cvpred          72.64 74.6 62.44 61.82 71.84 79.0373 61.95 63.56 74.754 74.47
## Life.expectancy 65.50 77.2 58.60 69.00 74.10 79.0000 59.30 66.20 75.100 72.50
## CV residual     -7.14  2.6 -3.84  7.18  2.26 -0.0373 -2.65  2.64  0.346 -1.97
## 
## Sum of squares = 3245    Mean square = 14.1    n = 231 
## 
## Overall (Sum over all 231 folds) 
##   ms 
## 12.6
mean((data.test$Life.expectancy - predict(model.selected, data.test)) ^ 2)
## [1] 13.5

VIF for the additive model

vif(model.additive)
##                            Year                StatusDeveloping 
##                            1.16                            1.83 
##                 Adult.Mortality                   infant.deaths 
##                            1.71                          261.01 
##                         Alcohol          percentage.expenditure 
##                            2.36                           10.34 
##                     Hepatitis.B                         Measles 
##                            1.66                            1.54 
##                             BMI               under.five.deaths 
##                            1.73                          254.12 
##                           Polio               Total.expenditure 
##                            1.69                            1.12 
##                      Diphtheria                        HIV.AIDS 
##                            2.06                            1.42 
##                             GDP                      Population 
##                           10.95                            1.91 
##            thinness..1.19.years              thinness.5.9.years 
##                            8.59                            8.69 
## Income.composition.of.resources                       Schooling 
##                            3.06                            3.67
which(vif(model.additive) > 5)
##          infant.deaths percentage.expenditure      under.five.deaths 
##                      4                      6                     10 
##                    GDP   thinness..1.19.years     thinness.5.9.years 
##                     15                     17                     18
vif(model.selected)
##                            Year                StatusDeveloping 
##                            1.12                            1.81 
##                 Adult.Mortality                   infant.deaths 
##                            1.68                          242.78 
##                         Alcohol          percentage.expenditure 
##                            2.31                            1.39 
##                             BMI               under.five.deaths 
##                            1.52                          244.30 
##               Total.expenditure                      Diphtheria 
##                            1.12                            1.24 
##                        HIV.AIDS Income.composition.of.resources 
##                            1.41                            3.03 
##                       Schooling 
##                            3.57
which(vif(model.selected) > 5)
##     infant.deaths under.five.deaths 
##                 4                 8

The selected model efficiently removed some predictors which have colinearity issues, but not all. We can see infant.deaths and under.five.deaths are still co-exist in the selected model.

plot(infant.deaths ~ under.five.deaths, data = data)

Model Building

# train test split 70/30 hold out
set.seed(42)
train_size = floor(0.7 * nrow(data))
train_idx = sample(nrow(data), train_size)
data_trn = data[train_idx, ]
data_tst = data[-train_idx, ]
# Define functions
calc_loocv_rmse = function(model) {
  c("LOOCV_RMSE:",sqrt(mean((resid(model) / (1 - hatvalues(model))) ^ 2)))
}

calc_bp = function(model) {
  c("BP test:", unname(bptest(model)$p.value))
}

calc_shapiro = function(model) {
  c("Shapiro test:", unname(shapiro.test(resid(model))$p.value))
}

calc_adj_r2 = function(model) {
  c("Adj.R2:", summary(model)$adj.r.squared)
}
# Model_1, basic additive model with all the parameters
model_1 = lm(Life.expectancy ~ ., data_trn)
par(mfrow=c(2,2))
plot(model_1)

calc_bp(model_1)
## [1] "BP test:"             "1.06753304313199e-18"
calc_shapiro(model_1)
## [1] "Shapiro test:"        "0.000142390687235932"
calc_loocv_rmse(model_1)
## [1] "LOOCV_RMSE:"      "3.58422898173348"
calc_adj_r2(model_1)
## [1] "Adj.R2:"           "0.831530797195294"
# Model_2, backward AIC on additive model
model_2 = step(model_1, trace = FALSE)
coef(model_2)
##                     (Intercept)                            Year 
##                        286.6524                         -0.1166 
##                StatusDeveloping                 Adult.Mortality 
##                         -0.7627                         -0.0148 
##                   infant.deaths                         Alcohol 
##                          0.0793                         -0.1400 
##          percentage.expenditure                             BMI 
##                          0.0005                          0.0338 
##               under.five.deaths                           Polio 
##                         -0.0597                          0.0108 
##               Total.expenditure                      Diphtheria 
##                          0.1513                          0.0136 
##                        HIV.AIDS            thinness..1.19.years 
##                         -0.4572                         -0.0626 
## Income.composition.of.resources                       Schooling 
##                         10.6011                          0.8706
par(mfrow=c(2,2))
plot(model_2)

calc_bp(model_2)
## [1] "BP test:"             "5.89766168948721e-20"
calc_shapiro(model_2)
## [1] "Shapiro test:"        "0.000152257737050676"
calc_loocv_rmse(model_2)
## [1] "LOOCV_RMSE:"      "3.57398562547131"
calc_adj_r2(model_2)
## [1] "Adj.R2:"           "0.832143041393922"
# Model_3, backward BIC on additive model
n = length(resid(model_1))
model_3 = step(model_1, k = log(n), trace = FALSE)
coef(model_3)
##                     (Intercept)                            Year 
##                       299.26327                        -0.12352 
##                 Adult.Mortality                   infant.deaths 
##                        -0.01516                         0.07874 
##                         Alcohol          percentage.expenditure 
##                        -0.09713                         0.00053 
##                             BMI               under.five.deaths 
##                         0.03721                        -0.06008 
##               Total.expenditure                      Diphtheria 
##                         0.16017                         0.01873 
##                        HIV.AIDS Income.composition.of.resources 
##                        -0.46262                        10.77947 
##                       Schooling 
##                         0.90100
par(mfrow=c(2,2))
plot(model_3)

calc_bp(model_3)
## [1] "BP test:"             "4.75415871100533e-22"
calc_shapiro(model_3)
## [1] "Shapiro test:"         "0.0000389851564983809"
calc_loocv_rmse(model_3)
## [1] "LOOCV_RMSE:"      "3.58063093482768"
calc_adj_r2(model_3)
## [1] "Adj.R2:"           "0.831059196901044"

We can see that no big improvement on AIC and BIC results based on the additive model.

Next, we will start with the interactive model.

# Model_4, basic interactive model with all the parameters
model_4 = lm(Life.expectancy ~ . ^ 2, data_trn)
par(mfrow=c(2,2))
plot(model_4)
## Warning in sqrt(crit * p * (1 - hh)/hh): NaNs produced

## Warning in sqrt(crit * p * (1 - hh)/hh): NaNs produced

calc_bp(model_4)
## [1] "BP test:"           "0.0350257273124796"
calc_shapiro(model_4)
## [1] "Shapiro test:"        "2.00075047432031e-14"
calc_loocv_rmse(model_4)
## [1] "LOOCV_RMSE:"      "6.32632579517486"
calc_adj_r2(model_4)
## [1] "Adj.R2:"           "0.907962924404157"
length(coef(model_4))
## [1] 211

We can see that the interactive model using all the predictors turns out really big and there are 211 parameters in the model. We will focus on the parameters that are selected by Model_2 and apply AIC on the interactive model based on those parameters.

# Model_5, interactive model based on Model_2
# under.five.deaths is excluded because the colinearity issue with infant.deanths parameters
coef(model_2)
##                     (Intercept)                            Year 
##                        286.6524                         -0.1166 
##                StatusDeveloping                 Adult.Mortality 
##                         -0.7627                         -0.0148 
##                   infant.deaths                         Alcohol 
##                          0.0793                         -0.1400 
##          percentage.expenditure                             BMI 
##                          0.0005                          0.0338 
##               under.five.deaths                           Polio 
##                         -0.0597                          0.0108 
##               Total.expenditure                      Diphtheria 
##                          0.1513                          0.0136 
##                        HIV.AIDS            thinness..1.19.years 
##                         -0.4572                         -0.0626 
## Income.composition.of.resources                       Schooling 
##                         10.6011                          0.8706
model_5 = lm(Life.expectancy ~ (Year + Status + Adult.Mortality + infant.deaths + Alcohol + percentage.expenditure + BMI + Polio + Total.expenditure
                                + Diphtheria + HIV.AIDS + thinness..1.19.years + Income.composition.of.resources + Schooling) ^ 2, data = data_trn)
par(mfrow=c(2,2))
plot(model_5)

calc_bp(model_5)
## [1] "BP test:"            "4.1462009319212e-07"
calc_shapiro(model_5)
## [1] "Shapiro test:"        "3.83717678229168e-11"
calc_loocv_rmse(model_5)
## [1] "LOOCV_RMSE:"      "3.00964718488528"
calc_adj_r2(model_5)
## [1] "Adj.R2:"           "0.895169999246715"
length(coef(model_5))
## [1] 106

Model_5 has lower BP and Shapiro test results compared to the first 3 models, however, there are still 106 parameters in the model. We will use AIC and BIC to reduce the model.

# Model_6, backward AIC on interactive model
model_6 = step(model_5, trace = FALSE)
par(mfrow=c(2,2))
plot(model_5)

calc_bp(model_5)
## [1] "BP test:"            "4.1462009319212e-07"
calc_shapiro(model_5)
## [1] "Shapiro test:"        "3.83717678229168e-11"
calc_loocv_rmse(model_5)
## [1] "LOOCV_RMSE:"      "3.00964718488528"
calc_adj_r2(model_5)
## [1] "Adj.R2:"           "0.895169999246715"
# Model_7, backward BIC on interactive model
n = length(resid(model_5))
model_7 = step(model_5, k = log(n), trace = FALSE)
par(mfrow=c(2,2))
plot(model_7)

calc_bp(model_7)
## [1] "BP test:"             "6.43673809602792e-12"
calc_shapiro(model_7)
## [1] "Shapiro test:"       "1.3729812233272e-10"
calc_loocv_rmse(model_7)
## [1] "LOOCV_RMSE:"      "2.92111619240649"
calc_adj_r2(model_7)
## [1] "Adj.R2:"           "0.890358899035256"

We can see that model_7 still have 39 parameters. To simply the model, we can use p-value < 0.0001 to filter predictors. We will also add second order predictors and use AIC/BIC to further reduce model.

length(coef(model_7))
## [1] 39
which(summary(model_7)$coefficients[,4] < 0.0001)
##                                   Adult.Mortality 
##                                                 4 
##                                               BMI 
##                                                 8 
##                                        Diphtheria 
##                                                11 
##                              thinness..1.19.years 
##                                                13 
##                   Income.composition.of.resources 
##                                                14 
##                                         Schooling 
##                                                15 
##              Year:Income.composition.of.resources 
##                                                18 
##                                    Year:Schooling 
##                                                19 
##                  StatusDeveloping:Adult.Mortality 
##                                                20 
##             StatusDeveloping:thinness..1.19.years 
##                                                22 
##                         Adult.Mortality:Schooling 
##                                                25 
##     infant.deaths:Income.composition.of.resources 
##                                                26 
##                           infant.deaths:Schooling 
##                                                27 
##                         Alcohol:Total.expenditure 
##                                                28 
##                                  Alcohol:HIV.AIDS 
##                                                29 
##           Alcohol:Income.composition.of.resources 
##                                                31 
##                                    BMI:Diphtheria 
##                                                33 
##               BMI:Income.composition.of.resources 
##                                                34 
##                                     BMI:Schooling 
##                                                35 
## Total.expenditure:Income.composition.of.resources 
##                                                38
model_8 = lm(Life.expectancy ~ Adult.Mortality + BMI + Diphtheria + thinness..1.19.years + Income.composition.of.resources + Schooling +  Year:Income.composition.of.resources + Year:Schooling + Status:Adult.Mortality + Status:thinness..1.19.years + Adult.Mortality:Schooling + infant.deaths:Income.composition.of.resources + infant.deaths:Schooling + Alcohol:Total.expenditure + Alcohol:HIV.AIDS + Alcohol:Income.composition.of.resources + BMI:Diphtheria + BMI:Income.composition.of.resources + BMI:Schooling + Total.expenditure:Income.composition.of.resources + I(Adult.Mortality^2) + I(BMI^2) + I(Diphtheria^2) + I(thinness..1.19.years^2) + I(Income.composition.of.resources^2) + I(Schooling^2), data = data_trn)
length(coef(model_8))
## [1] 27
# Model_9, backward AIC on reduced model
model_9 = step(model_8, trace = FALSE)
par(mfrow=c(2,2))
plot(model_9)

calc_bp(model_9)
## [1] "BP test:"             "1.25586859508963e-17"
calc_shapiro(model_9)
## [1] "Shapiro test:"        "1.43501270267459e-09"
calc_loocv_rmse(model_9)
## [1] "LOOCV_RMSE:"      "3.01869412852157"
calc_adj_r2(model_9)
## [1] "Adj.R2:"           "0.881224986529788"
# Model_10, backward BIC on reduced model
n = length(resid(model_8))
model_10 = step(model_8, k = log(n), trace = FALSE)
par(mfrow=c(2,2))
plot(model_10)

calc_bp(model_10)
## [1] "BP test:"             "2.86982827390071e-17"
calc_shapiro(model_10)
## [1] "Shapiro test:"        "2.48317788164929e-09"
calc_loocv_rmse(model_10)
## [1] "LOOCV_RMSE:"      "3.02059894996611"
calc_adj_r2(model_10)
## [1] "Adj.R2:"           "0.880949043095113"
length(coef(model_10))
## [1] 24

There are still 24 parameters after BIC step.

Change strategy, use the first order predictors in model_8 to build the interactive and second order models and apply AIC/BIC on it.

model_11 = lm(Life.expectancy ~ (Adult.Mortality + BMI + Diphtheria + thinness..1.19.years + Income.composition.of.resources + Schooling) ^ 2 + I(Adult.Mortality^2) + I(BMI^2) + I(Diphtheria^2) + I(thinness..1.19.years^2) + I(Income.composition.of.resources^2) + I(Schooling^2), data = data_trn)
length(coef(model_11))
## [1] 28
# Model_12, backward AIC on reduced model_11
model_12 = step(model_11, trace = FALSE)
par(mfrow=c(2,2))
plot(model_12)

calc_bp(model_12)
## [1] "BP test:"             "9.32569415279849e-16"
calc_shapiro(model_12)
## [1] "Shapiro test:"       "6.9418924612486e-16"
calc_loocv_rmse(model_12)
## [1] "LOOCV_RMSE:"      "3.20536581835464"
calc_adj_r2(model_12)
## [1] "Adj.R2:"           "0.866503456987311"
length(coef(model_12))
## [1] 20
# Model_13, backward BIC on reduced model_11
n = length(resid(model_11))
model_13 = step(model_11, k = log(n), trace = FALSE)
par(mfrow=c(2,2))
plot(model_13)

calc_bp(model_13)
## [1] "BP test:"             "1.38613074491302e-18"
calc_shapiro(model_13)
## [1] "Shapiro test:"        "3.08693987626621e-16"
calc_loocv_rmse(model_13)
## [1] "LOOCV_RMSE:"      "3.21577815809087"
calc_adj_r2(model_13)
## [1] "Adj.R2:"          "0.86449056663892"
length(coef(model_13))
## [1] 16

Results

Discussion

Appendix